From 4b422ceacc1c99d4bd1b21d65526da502a7fabf4 Mon Sep 17 00:00:00 2001 From: sadanslargehole Date: Sun, 21 Apr 2024 19:57:10 -0400 Subject: [PATCH] 26 current 2024-04-21 19:57:03 24.05.20240419.5c24cf2 6.6.28 * --- boxes/desktop/configuration.nix | 162 +++++++++++++++++++++++ boxes/desktop/hardware-configuration.nix | 41 ++++++ boxes/desktop/home.nix | 73 ++++++++++ build | 32 +++++ build.log | 39 ++++++ common/packages.nix | 0 flake.lock | 48 +++++++ flake.nix | 32 +++++ 8 files changed, 427 insertions(+) create mode 100644 boxes/desktop/configuration.nix create mode 100644 boxes/desktop/hardware-configuration.nix create mode 100644 boxes/desktop/home.nix create mode 100755 build create mode 100644 build.log create mode 100644 common/packages.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/boxes/desktop/configuration.nix b/boxes/desktop/configuration.nix new file mode 100644 index 0000000..d84f4d4 --- /dev/null +++ b/boxes/desktop/configuration.nix @@ -0,0 +1,162 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +# { config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.grub.device = "nodev"; + boot.loader.grub.efiSupport = true; + boot.loader.grub.useOSProber = true; + boot.loader.grub.efiInstallAsRemovable = true; + + networking.hostName = "nix-desktop-evo4b5"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; +services.xserver = { + enable = true; + displayManager.sddm = { + enable = true; + }; + desktopManager.plasma6.enable = true; +}; + # Enable the X11 windowing system. + # servives.desktopManager.plasma6.enable = true; + # services.desktopManager.plasma6.enable = true; + + + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + services.printing.enable = true; + nix.settings.experimental-features = ["nix-command" "flakes"]; + # Enable sound. + sound.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + # hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.meyer = { + isNormalUser = true; + extraGroups = [ + "wheel" # Enable ‘sudo’ for the user. + "audio" "sound" "video" + "networkmanager" + "input" "tty" + ]; + packages = with pkgs; [ + google-chrome + bitwarden + spotify + vscodium + discord + kitty + rofi + ]; + }; + home-manager = { + extraSpecialArgs = {inherit inputs;}; + users = { + "meyer" = import ./home.nix; + }; + }; +nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + curl + wget + git + ripgrep + tldr + gnupg + openssh + pinentry-rofi + libnotify + ]; +#LD fix +programs.nix-ld.enable = true; +programs.nix-ld.libraries = with pkgs; [ +pkgs.curlWithGnuTls +]; +programs.gnupg.agent = { +enable = true; +pinentryPackage = pkgs.pinentry-rofi; +enableSSHSupport = true; +}; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + +} + diff --git a/boxes/desktop/hardware-configuration.nix b/boxes/desktop/hardware-configuration.nix new file mode 100644 index 0000000..5245299 --- /dev/null +++ b/boxes/desktop/hardware-configuration.nix @@ -0,0 +1,41 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/789aab6a-3f46-4023-9aab-0569bb06bcde"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/FA5C-26B6"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/8d59260c-90c4-440e-8ac6-f0135e90451f"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp8s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/boxes/desktop/home.nix b/boxes/desktop/home.nix new file mode 100644 index 0000000..e39ee01 --- /dev/null +++ b/boxes/desktop/home.nix @@ -0,0 +1,73 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "meyer"; + home.homeDirectory = "/home/meyer"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + pkgs.hello + pkgs.xsel + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/meyer/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/build b/build new file mode 100755 index 0000000..ada133b --- /dev/null +++ b/build @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -e + +#Change to change box setup +BOX="default" + +pushd ~/nixos/ + +if git diff --quiet '*.nix' && [[ !( $1 =~ "*force*") ]] then + echo "No changes. Exiting" + # notify-send "No changes. Exiting" + popd + exit 0 +fi + +#TODO: Format files +#format ** + +#show changes +git diff -U0 '*.nix' + +echo "Starting build" + +sudo nixos-rebuild switch --flake .#${BOX} &> build.log || (cat build.log | grep --color error && notify-send "ERROR BUILDING NIX" && exit 1) + +current=$(nixos-rebuild list-generations | grep current) + +git commit -am "${current}" + +popd +notify-send -e "good build" --icon=software-update-okay diff --git a/build.log b/build.log new file mode 100644 index 0000000..7973d4f --- /dev/null +++ b/build.log @@ -0,0 +1,39 @@ +warning: Git tree '/home/meyer/nixos' is dirty +building the system configuration... +warning: Git tree '/home/meyer/nixos' is dirty +trace: warning: The option `services.xserver.desktopManager.plasma6.enable' defined in `/nix/store/swx3jn2249ldx8gk85f36p81996l6vf2-source/boxes/desktop/configuration.nix' has been renamed to `services.desktopManager.plasma6.enable'. +trace: warning: The option `services.xserver.displayManager.sddm.enable' defined in `/nix/store/swx3jn2249ldx8gk85f36p81996l6vf2-source/boxes/desktop/configuration.nix' has been renamed to `services.displayManager.sddm.enable'. +these 7 derivations will be built: + /nix/store/x3lg24z4wnb4gcq3albaaysw2bics53s-home-manager-path.drv + /nix/store/jh0xn5p5h3ffl4xzm09glnr0ks7qlnvx-activation-script.drv + /nix/store/hpjjgylrgid65daxdf2j4nrf46zl423n-home-manager-generation.drv + /nix/store/icbd76d7gan61wym90gl6c8fapcfvlk9-unit-home-manager-meyer.service.drv + /nix/store/9rmznanpgxizsqlf6v3fily4jbsrgx6i-system-units.drv + /nix/store/zqgs97dwg59ih1yxh2fjzfv6y49ygqxy-etc.drv + /nix/store/hp3xpllpd5qh7vw8p4659hznmjwz79af-nixos-system-nix-desktop-evo4b5-24.05.20240419.5c24cf2.drv +this path will be fetched (0.02 MiB download, 0.05 MiB unpacked): + /nix/store/8shlpd8hhnc1gv1qjdm49mxmpwb06din-xsel-1.2.1 +copying path '/nix/store/8shlpd8hhnc1gv1qjdm49mxmpwb06din-xsel-1.2.1' from 'https://cache.nixos.org'... +building '/nix/store/x3lg24z4wnb4gcq3albaaysw2bics53s-home-manager-path.drv'... +building '/nix/store/jh0xn5p5h3ffl4xzm09glnr0ks7qlnvx-activation-script.drv'... +building '/nix/store/hpjjgylrgid65daxdf2j4nrf46zl423n-home-manager-generation.drv'... +building '/nix/store/icbd76d7gan61wym90gl6c8fapcfvlk9-unit-home-manager-meyer.service.drv'... +building '/nix/store/9rmznanpgxizsqlf6v3fily4jbsrgx6i-system-units.drv'... +building '/nix/store/zqgs97dwg59ih1yxh2fjzfv6y49ygqxy-etc.drv'... +building '/nix/store/hp3xpllpd5qh7vw8p4659hznmjwz79af-nixos-system-nix-desktop-evo4b5-24.05.20240419.5c24cf2.drv'... +updating GRUB 2 menu... +Warning: os-prober will be executed to detect other bootable partitions. +Its output will be used to detect bootable binaries on them and create new boot entries. +error: invalid volume. +grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map. +error: invalid volume. +grub-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map. +lsblk: /dev/mapper/no*[0-9]: not a block device +lsblk: /dev/mapper/raid*[0-9]: not a block device +lsblk: /dev/mapper/disks*[0-9]: not a block device +Found Windows Boot Manager on /dev/nvme0n1p2@/efi/Microsoft/Boot/bootmgfw.efi +activating the configuration... +setting up /etc... +reloading user units for meyer... +restarting sysinit-reactivation.target +restarting the following units: home-manager-meyer.service diff --git a/common/packages.nix b/common/packages.nix new file mode 100644 index 0000000..e69de29 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b2dc6dd --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713713092, + "narHash": "sha256-rvyr6BBtn3cq5B/48rhJlbIOpxprwlO/71663sd9Gik=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2846d5230a3c3923618eabb367deaf8885df580f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..febc522 --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations = { + default = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./boxes/desktop/configuration.nix + inputs.home-manager.nixosModules.default + + ]; + }; + }; + # nixosConfigurations.default = nixpkgs.lib.nixosSystem { + # specialArgs = {inherit inputs;}; + # modules = [ + # ./boxes/desktop/configuration.nix + # inputs.home-manager.nixosModules.default + # ]; + # }; + }; +}