diff --git a/flake.lock b/flake.lock index ee72420..072330f 100644 --- a/flake.lock +++ b/flake.lock @@ -314,11 +314,11 @@ ] }, "locked": { - "lastModified": 1734279981, - "narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=", + "lastModified": 1734425854, + "narHash": "sha256-nzE5UbJ41aPEKf8R2ZFYtLkqPmF7EIUbNEdHMBLg0Ig=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785", + "rev": "0ddd26d0925f618c3a5d85a4fa5eb1e23a09491d", "type": "github" }, "original": { @@ -416,11 +416,11 @@ ] }, "locked": { - "lastModified": 1734093295, - "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", + "lastModified": 1734344598, + "narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=", "owner": "nix-community", "repo": "home-manager", - "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", + "rev": "83ecd50915a09dca928971139d3a102377a8d242", "type": "github" }, "original": { @@ -524,11 +524,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1734456362, - "narHash": "sha256-eb+OcQaSp7pcJxNe6wi52AiqLle820aD4Ejq10wmsjo=", + "lastModified": 1734563337, + "narHash": "sha256-0nOMDLi0aldc7VUfy/aBBL+4QLizccuSRG/MsBCrLQk=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "5f1df55fcb45a72e92258113685aa9064f6ebf3e", + "rev": "23e7d8f6a7d4e25c2dc6be33af07249570e66940", "type": "github" }, "original": { @@ -799,11 +799,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1734119587, - "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "lastModified": 1734424634, + "narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "type": "github" }, "original": { @@ -860,11 +860,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1734472356, - "narHash": "sha256-RIoG3zXarfuHfzM/z/NPjoHHxl3sqYrtEatSLA1/bIk=", + "lastModified": 1734563049, + "narHash": "sha256-P/103iUx75XPXeX21M20kzttGaZJ6+c8xp9yo3fx3Zg=", "owner": "nix-community", "repo": "nixvim", - "rev": "4f1fe403b18c45614d6b81423038a34cff371244", + "rev": "79a637d1962e725218ff46f5234cb3d5617ed36b", "type": "github" }, "original": { @@ -955,11 +955,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1733965552, - "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=", + "lastModified": 1734546875, + "narHash": "sha256-6OvJbqQ6qPpNw3CA+W8Myo5aaLhIJY/nNFDk3zMXLfM=", "owner": "Mic92", "repo": "sops-nix", - "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004", + "rev": "ed091321f4dd88afc28b5b4456e0a15bd8374b4d", "type": "github" }, "original": { @@ -985,11 +985,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1734110168, - "narHash": "sha256-Q0eeLYn45ErXlqGQyXmLLHGe1mqnUiK0Y9wZRa1SNFI=", + "lastModified": 1734531336, + "narHash": "sha256-BWwJTAiWmZudUdUbyets7e3zQfjvZYtkU51blBnUBjw=", "owner": "danth", "repo": "stylix", - "rev": "a9e3779949925ef22f5a215c5f49cf520dea30b1", + "rev": "a2d66f25478103ac9b4adc6d6713794f7005221e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index cbe535e..f0893c2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,20 +1,20 @@ { - description = "NixOS config"; + description = "NixOS config"; - inputs = { - nixpkgs = { - url = "github:nixos/nixpkgs?ref=nixos-unstable"; - }; - nixvim = { + inputs = { + nixpkgs = { + url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; hyprland.url = "github:hyprwm/Hyprland"; stylix.url = "github:danth/stylix"; - #nix-flatpak.url = "github:GermanBread/declarative-flatpak/stable-v3"; +#nix-flatpak.url = "github:GermanBread/declarative-flatpak/stable-v3"; apple-silicon-support.url = "github:tpwrules/nixos-apple-silicon"; - #nur.url = "github:nix-community/NUR"; +#nur.url = "github:nix-community/NUR"; sops-nix.url = "github:Mic92/sops-nix"; home-manager = { @@ -22,106 +22,102 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; }; nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; - + impermanence.url = "github:nix-community/impermanence"; }; outputs = { self, nixpkgs, stylix, nixvim, ... }@inputs: - let - #systems = ["aarch64-linux" "x86_64-linux" ]; - #forAllSystems = nixpkgs.lib.genAttrs systems; - #pkgs = import nixpkgs { - # inherit system; - # config = { - # allowUnfree = true; - # }; - #}; - arm = "aarch64-linux"; - x86 = "x86_64-linux"; - username = "kylekrein"; + let +#systems = ["aarch64-linux" "x86_64-linux" ]; +#forAllSystems = nixpkgs.lib.genAttrs systems; +#pkgs = import nixpkgs { +# inherit system; +# config = { +# allowUnfree = true; +# }; +#}; + arm = "aarch64-linux"; + x86 = "x86_64-linux"; - general-modules = [ - inputs.sops-nix.nixosModules.sops - inputs.home-manager.nixosModules.default - stylix.nixosModules.stylix - inputs.nixos-facter-modules.nixosModules.facter - ]; + general-modules = [ + inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.default + stylix.nixosModules.stylix + inputs.nixos-facter-modules.nixosModules.facter + ]; - first-nixos-install = "1729112485"; #stat -c %W / - in - { - nixosConfigurations = { - "${username}-homepc" = nixpkgs.lib.nixosSystem { - specialArgs = { - - hwconfig = { - hostname = "${username}-homepc"; - isLaptop = false; - system = x86; - useImpermanence = true; - }; - inherit username; - inherit first-nixos-install; - inherit inputs; }; - - system = x86; - #pkgs = import nixpkgs { - # system = x86; - # config = { - # allowBroken = true; - # allowUnfree = true; - # }; - # }; - modules = [ - inputs.impermanence.nixosModules.impermanence - inputs.disko.nixosModules.default - (import ./nixos/modules/disko/impermanence-disko.nix { device = "/dev/nvme0n1"; } ) - ./nixos/modules/impermanence - #nur.nixosModules.nur - ./nixos/configuration.nix - ./nixos/nvidia.nix - #./nixos/homepc-hardware-conf.nix - ./nixos/libvirt.nix - #nix-flatpak.nixosModules.default - ] ++ general-modules; - }; - "${username}-mac" = nixpkgs.lib.nixosSystem { - specialArgs = { - hwconfig = { - hostname = "${username}-mac"; - isLaptop = true; - system = arm; - useImpermanence = true; - }; - inherit username; - inherit first-nixos-install; - inherit inputs; }; - - system = arm; - #pkgs = import nixpkgs { - # system = arm; - # overlays = [ - # (import ./nixos/macos/widevine.nix) - # ]; - # config = { - # allowBroken = true; - # allowUnfree = true; - # }; - # }; - modules = [ - inputs.impermanence.nixosModules.impermanence - ./nixos/configuration.nix - ./nixos/modules/impermanence - inputs.apple-silicon-support.nixosModules.default - ./nixos/mac-hardware-conf.nix - ./nixos/macos/configuration.nix - ] ++ general-modules; - }; + first-nixos-install = "1729112485"; #stat -c %W / + in + { + nixosConfigurations = { + "kylekrein-homepc" = nixpkgs.lib.nixosSystem { + specialArgs = { + + hwconfig = { + hostname = "kylekrein-homepc"; + isLaptop = false; + system = x86; + useImpermanence = true; + }; + inherit first-nixos-install; + inherit inputs; }; + + system = x86; +#pkgs = import nixpkgs { +# system = x86; +# config = { +# allowBroken = true; +# allowUnfree = true; +# }; +# }; + modules = [ + inputs.impermanence.nixosModules.impermanence + inputs.disko.nixosModules.default + (import ./nixos/modules/disko/impermanence-disko.nix { device = "/dev/nvme0n1"; } ) + ./nixos/modules/impermanence +#nur.nixosModules.nur + ./nixos/configuration.nix + ./nixos/hardware/nvidia.nix +#./nixos/homepc-hardware-conf.nix +#nix-flatpak.nixosModules.default + ] ++ general-modules; + }; + "kylekrein-mac" = nixpkgs.lib.nixosSystem { + specialArgs = { + hwconfig = { + hostname = "kylekrein-mac"; + isLaptop = true; + system = arm; + useImpermanence = true; + }; + inherit first-nixos-install; + inherit inputs; }; + + system = arm; +#pkgs = import nixpkgs { +# system = arm; +# overlays = [ +# (import ./nixos/macos/widevine.nix) +# ]; +# config = { +# allowBroken = true; +# allowUnfree = true; +# }; +# }; + modules = [ + inputs.impermanence.nixosModules.impermanence + ./nixos/configuration.nix + ./nixos/modules/impermanence + inputs.apple-silicon-support.nixosModules.default + ./nixos/hosts/kylekrein-mac/mac-hardware-conf.nix + ./nixos/hardware/macos/configuration.nix + ] ++ general-modules; + }; + }; }; - }; } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 017c186..7e8a58e 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -2,13 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, lib, pkgs, stylix, hwconfig, first-nixos-install, username, nixvim, inputs, ... }: +{ config, lib, pkgs, stylix, hwconfig, first-nixos-install, nixvim, inputs, ... }: { imports = [ # Include the results of the hardware scan. inputs.home-manager.nixosModules.default inputs.nixvim.nixosModules.nixvim - ./firefox.nix + ./modules/firefox ./modules/services/autoupgrade ./modules/sops ./hosts/${hwconfig.hostname} @@ -16,9 +16,9 @@ facter.reportPath = ./hosts/${hwconfig.hostname}/facter.json; kylekrein.services.autoUpgrade = { enable = true; - pushUpdates = if hwconfig.hostname == "${username}-homepc" then true else false; - configDir = "/home/${username}/nixos-config"; - user = username; + pushUpdates = if hwconfig.hostname == "kylekrein-homepc" then true else false; + configDir = "/etc/nixos-config"; + user = "root"; }; boot = { @@ -27,7 +27,7 @@ }; loader = { systemd-boot.enable = true; - efi.canTouchEfiVariables = if hwconfig.hostname != "${username}-mac" then true else false; + efi.canTouchEfiVariables = if hwconfig.hostname != "kylekrein-mac" then true else false; }; # Enable "Silent Boot" consoleLogLevel = 0; @@ -93,19 +93,7 @@ # https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3 hashedPassword = "!"; # disable root logins, nothing hashes to ! }; - ${username} = { - isNormalUser = true; - description = "Aleksandr Lebedev"; - extraGroups = [ "networkmanager" "wheel" ]; - initialPassword = "1234"; - packages = with pkgs; []; - }; - }; - #test = { - # isNormalUser = true; - # initialPassword = "1234"; - # extraGroups = [ "networkmanager" ]; - #}; + }; }; qt = { @@ -265,7 +253,7 @@ enable = true; clean.enable = true; clean.extraArgs = "--keep-since 4d --keep 3"; - flake = "/home/${username}/nixos-config"; + flake = "/etc/nixos-config"; }; #https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3 # This fixes the unpopulated MIME menus @@ -332,14 +320,11 @@ }; home-manager = { - extraSpecialArgs = {inherit pkgs; inherit hwconfig; inherit username; inherit first-nixos-install; inherit nixvim; inherit inputs;}; - users = { - "${username}" = import ./home.nix; - }; + extraSpecialArgs = {inherit pkgs; inherit hwconfig; inherit first-nixos-install; inherit nixvim; inherit inputs;}; }; stylix = { enable = true; - image = "${./hyprland/wallpaper.jpg}"; + image = "${./modules/hyprland/wallpaper.jpg}"; autoEnable = true; opacity = { desktop = 0.5; diff --git a/nixos/empty.nix b/nixos/empty.nix deleted file mode 100644 index 6416a04..0000000 --- a/nixos/empty.nix +++ /dev/null @@ -1,2 +0,0 @@ -{}: -{} diff --git a/nixos/macos/configuration.nix b/nixos/hardware/macos/configuration.nix similarity index 100% rename from nixos/macos/configuration.nix rename to nixos/hardware/macos/configuration.nix diff --git a/nixos/macos/firmware/all_firmware.tar.gz b/nixos/hardware/macos/firmware/all_firmware.tar.gz similarity index 100% rename from nixos/macos/firmware/all_firmware.tar.gz rename to nixos/hardware/macos/firmware/all_firmware.tar.gz diff --git a/nixos/macos/firmware/kernelcache.release.mac13g b/nixos/hardware/macos/firmware/kernelcache.release.mac13g similarity index 100% rename from nixos/macos/firmware/kernelcache.release.mac13g rename to nixos/hardware/macos/firmware/kernelcache.release.mac13g diff --git a/nixos/macos/homemac.nix b/nixos/hardware/macos/homemac.nix similarity index 100% rename from nixos/macos/homemac.nix rename to nixos/hardware/macos/homemac.nix diff --git a/nixos/macos/widevine-overlay.nix b/nixos/hardware/macos/widevine-overlay.nix similarity index 100% rename from nixos/macos/widevine-overlay.nix rename to nixos/hardware/macos/widevine-overlay.nix diff --git a/nixos/macos/widevine.nix b/nixos/hardware/macos/widevine.nix similarity index 100% rename from nixos/macos/widevine.nix rename to nixos/hardware/macos/widevine.nix diff --git a/nixos/nvidia.nix b/nixos/hardware/nvidia.nix similarity index 100% rename from nixos/nvidia.nix rename to nixos/hardware/nvidia.nix diff --git a/nixos/home.nix b/nixos/home.nix index 230138e..01bc377 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -13,11 +13,12 @@ { imports = [ - ./hyprland/hyprland.nix - ./nixvim - ./fastfetch + ./modules/hyprland + ./modules/nixvim + ./modules/fastfetch + ./homes/${username} #"${if hostname != "nixosbtw" then ./macos/homemac.nix else ./empty.nix }" - ] ++ (if hwconfig.useImpermanence then [ ./modules/impermanence/home.nix ] else []); + ] ++ (if hwconfig.useImpermanence then [ (import ./modules/impermanence/home.nix { inherit username; inherit inputs; } ) ] else []); # Home Manager needs a bit of information about you and the paths it should # manage. home.username = username; @@ -101,44 +102,7 @@ #Also available: Catppuccin-Frappe Catppuccin-Latte Catppuccin-Macchiato Catppuccin-Mocha # See all available kitty themes at: https://github.com/kovidgoyal/kitty-themes/blob/46d9dfe230f315a6a0c62f4687f6b3da20fd05e4/themes.json }; - programs.git = { - enable = true; - userName = "Aleksandr Lebedev"; - userEmail = "alex.lebedev2003@icloud.com"; - extraConfig = { - credential.helper = "manager";#"${pkgs.git.override { withLibsecret = true; }}/bin/git-credential-libsecret"; - credential."https://github.com".username = "KyleKrein"; - credential.credentialStore = "plaintext"; - }; - }; - - #gtk = { -# enable = true; -# cursorTheme.name = "Bibata-Modern-Ice"; -# cursorTheme.package = pkgs.bibata-cursors; -# theme.package = pkgs.adw-gtk3; -# theme.name = "adw-gtk3"; -# iconTheme.package = gruvboxPlus; -# iconTheme.name = "GruvboxPlus"; - # }; - - #programs.firefox = { - #enable = true; - #profiles."kylekrein".extensions = with nur.repos.rycee.firefox-addons; [ - # ublock-origin - #darkreader - #videospeed - #auto-tab-discard - #privacy-badger - #sponsorblock - #]; - #profiles.default = { - # id = 0; - # name = "Default"; - # isDefault = true; - #}; -#}; # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. diff --git a/nixos/homes/kylekrein/default.nix b/nixos/homes/kylekrein/default.nix new file mode 100644 index 0000000..d3a8ab7 --- /dev/null +++ b/nixos/homes/kylekrein/default.nix @@ -0,0 +1,14 @@ +{ username, ... }: +{ + programs.git = { + enable = true; + userName = "Aleksandr Lebedev"; + userEmail = "alex.lebedev2003@icloud.com"; + extraConfig = { + credential.helper = "manager";#"${pkgs.git.override { withLibsecret = true; }}/bin/git-credential-libsecret"; + credential."https://github.com".username = "KyleKrein"; + credential.credentialStore = "plaintext"; + }; + }; + +} diff --git a/nixos/hosts/kylekrein-homepc/default.nix b/nixos/hosts/kylekrein-homepc/default.nix index 9450fc4..e2d811f 100644 --- a/nixos/hosts/kylekrein-homepc/default.nix +++ b/nixos/hosts/kylekrein-homepc/default.nix @@ -1,4 +1,10 @@ { pkgs, lib, hwconfig, inputs, ... }: { + imports = [ + ../../modules/libvirt + + ../../users/kylekrein + (import ../../modules/libvirt/user.nix { username = "kylekrein"; }) + ]; systemd.network.wait-online.enable = lib.mkForce false; } diff --git a/nixos/homepc-hardware-conf.nix b/nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix similarity index 100% rename from nixos/homepc-hardware-conf.nix rename to nixos/hosts/kylekrein-homepc/homepc-hardware-conf.nix diff --git a/nixos/hosts/kylekrein-mac/default.nix b/nixos/hosts/kylekrein-mac/default.nix new file mode 100644 index 0000000..3fb8567 --- /dev/null +++ b/nixos/hosts/kylekrein-mac/default.nix @@ -0,0 +1,6 @@ +{ pkgs, lib, hwconfig, ... }: +{ + imports = [ + ../../users/kylekrein + ]; +} diff --git a/nixos/mac-hardware-conf.nix b/nixos/hosts/kylekrein-mac/mac-hardware-conf.nix similarity index 100% rename from nixos/mac-hardware-conf.nix rename to nixos/hosts/kylekrein-mac/mac-hardware-conf.nix diff --git a/nixos/fastfetch/default.nix b/nixos/modules/fastfetch/default.nix similarity index 100% rename from nixos/fastfetch/default.nix rename to nixos/modules/fastfetch/default.nix diff --git a/nixos/fastfetch/nixos.png b/nixos/modules/fastfetch/nixos.png similarity index 100% rename from nixos/fastfetch/nixos.png rename to nixos/modules/fastfetch/nixos.png diff --git a/nixos/firefox.nix b/nixos/modules/firefox/default.nix similarity index 100% rename from nixos/firefox.nix rename to nixos/modules/firefox/default.nix diff --git a/nixos/modules/hyprland/default.nix b/nixos/modules/hyprland/default.nix new file mode 100644 index 0000000..304b7b7 --- /dev/null +++ b/nixos/modules/hyprland/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./hyprland.nix + ]; +} diff --git a/nixos/hyprland/hypridle.nix b/nixos/modules/hyprland/hypridle.nix similarity index 100% rename from nixos/hyprland/hypridle.nix rename to nixos/modules/hyprland/hypridle.nix diff --git a/nixos/hyprland/hyprland.nix b/nixos/modules/hyprland/hyprland.nix similarity index 98% rename from nixos/hyprland/hyprland.nix rename to nixos/modules/hyprland/hyprland.nix index f7a24c1..1821dd3 100644 --- a/nixos/hyprland/hyprland.nix +++ b/nixos/modules/hyprland/hyprland.nix @@ -13,7 +13,7 @@ in enable = true; xwayland.enable = true; settings = { - monitor = if hwconfig.hostname == "${username}-homepc" then [ + monitor = if hwconfig.hostname == "kylekrein-homepc" then [ "DP-1,2560x1440@75,1600x0,1.6" "DP-3,2560x1440@75,0x0,1.6" ] else [",highres,auto,1.6"] diff --git a/nixos/hyprland/hyprlock.nix b/nixos/modules/hyprland/hyprlock.nix similarity index 100% rename from nixos/hyprland/hyprlock.nix rename to nixos/modules/hyprland/hyprlock.nix diff --git a/nixos/hyprland/power_menu.xml b/nixos/modules/hyprland/power_menu.xml similarity index 100% rename from nixos/hyprland/power_menu.xml rename to nixos/modules/hyprland/power_menu.xml diff --git a/nixos/hyprland/profile-image.png b/nixos/modules/hyprland/profile-image.png similarity index 100% rename from nixos/hyprland/profile-image.png rename to nixos/modules/hyprland/profile-image.png diff --git a/nixos/hyprland/toggle_monitors.sh b/nixos/modules/hyprland/toggle_monitors.sh similarity index 100% rename from nixos/hyprland/toggle_monitors.sh rename to nixos/modules/hyprland/toggle_monitors.sh diff --git a/nixos/hyprland/wallpaper.jpg b/nixos/modules/hyprland/wallpaper.jpg similarity index 100% rename from nixos/hyprland/wallpaper.jpg rename to nixos/modules/hyprland/wallpaper.jpg diff --git a/nixos/hyprland/waybar.nix b/nixos/modules/hyprland/waybar.nix similarity index 100% rename from nixos/hyprland/waybar.nix rename to nixos/modules/hyprland/waybar.nix diff --git a/nixos/hyprland/waybarstyle.css b/nixos/modules/hyprland/waybarstyle.css similarity index 100% rename from nixos/hyprland/waybarstyle.css rename to nixos/modules/hyprland/waybarstyle.css diff --git a/nixos/modules/impermanence/default.nix b/nixos/modules/impermanence/default.nix index 3353259..ace8cd6 100644 --- a/nixos/modules/impermanence/default.nix +++ b/nixos/modules/impermanence/default.nix @@ -1,4 +1,4 @@ -{ lib, username, ... }: +{ lib, ... }: { fileSystems."/persist".neededForBoot = true; @@ -20,7 +20,7 @@ }; systemd.tmpfiles.rules = [ "d /persist/home/ 0777 root root -" # /persist/home created, owned by root - "d /persist/home/${username} 0700 ${username} users -" # /persist/home/ created, owned by that user + #"d /persist/home/${username} 0700 ${username} users -" # /persist/home/ created, owned by that user #"d /persist/nixos-config 0700 ${username} users -" ]; diff --git a/nixos/libvirt.nix b/nixos/modules/libvirt/default.nix similarity index 60% rename from nixos/libvirt.nix rename to nixos/modules/libvirt/default.nix index d48e8a4..395390a 100644 --- a/nixos/libvirt.nix +++ b/nixos/modules/libvirt/default.nix @@ -1,4 +1,4 @@ -{ pkgs, username, ... }: +{ pkgs, ... }: { virtualisation = { libvirtd = { @@ -13,8 +13,6 @@ spiceUSBRedirection.enable = true; }; - users.users.${username}.extraGroups = [ "libvirtd" ]; - environment.systemPackages = with pkgs; [ spice spice-gtk @@ -24,13 +22,4 @@ #win-spice ]; programs.virt-manager.enable = true; - - home-manager.users.${username} = { - dconf.settings = { - "org/virt-manager/virt-manager/connections" = { - autoconnect = [ "qemu:///system" ]; - uris = [ "qemu:///system" ]; - }; - }; - }; } diff --git a/nixos/modules/libvirt/user.nix b/nixos/modules/libvirt/user.nix new file mode 100644 index 0000000..3fe5bc3 --- /dev/null +++ b/nixos/modules/libvirt/user.nix @@ -0,0 +1,12 @@ +{ username, ... }: +{ + users.users.${username}.extraGroups = [ "libvirtd" ]; + home-manager.users.${username} = { + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; + }; + }; + }; +} diff --git a/nixos/nixvim/default.nix b/nixos/modules/nixvim/default.nix similarity index 100% rename from nixos/nixvim/default.nix rename to nixos/modules/nixvim/default.nix diff --git a/nixos/modules/sops/default.nix b/nixos/modules/sops/default.nix index 479b15e..a311f29 100644 --- a/nixos/modules/sops/default.nix +++ b/nixos/modules/sops/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, username, lib, hwconfig, ... }: +{ config, pkgs, inputs, lib, hwconfig, ... }: let keyPath = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/var/lib/sops/age/keys.txt"); in @@ -9,14 +9,4 @@ in sops.age.keyFile = keyPath; # This will generate a new key if the key specified above does not exist sops.age.generateKey = true; - - sops.secrets = { - "users/kylekrein" = { - neededForUsers = true; - }; - }; - users.users.${username} = { - hashedPasswordFile = config.sops.secrets."users/${username}".path; - initialPassword = lib.mkForce null; - }; } diff --git a/nixos/users/kylekrein/default.nix b/nixos/users/kylekrein/default.nix new file mode 100644 index 0000000..834e84b --- /dev/null +++ b/nixos/users/kylekrein/default.nix @@ -0,0 +1,28 @@ +{ pkgs, config, lib, hwconfig, inputs, stylix, first-nixos-install, ... }: +let username = "kylekrein"; +in +{ + imports = [ + ]; + users.users.${username} = { + isNormalUser = true; + description = "Aleksandr Lebedev"; + extraGroups = [ "networkmanager" "wheel" ]; + #initialPassword = "1234"; + hashedPasswordFile = config.sops.secrets."users/${username}".path; + packages = with pkgs; []; + }; + sops.secrets = { + "users/${username}" = { + neededForUsers = true; + }; + }; + + home-manager.users."${username}" = import ../../home.nix { inherit username; inherit inputs; inherit stylix; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; }; + kylekrein.services.autoUpgrade = { + configDir = lib.mkForce "/home/${username}/nixos-config"; + user = lib.mkForce username; + }; + programs.nh.flake = lib.mkForce "/home/${username}/nixos-config"; + systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/ created, owned by that user +}