diff --git a/flake.nix b/flake.nix index db61e01..a65dbc4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,15 +2,19 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; - neovim-nightly.url = "github:nix-community/neovim-nightly-overlay"; - agenix.url = "github:ryantm/agenix"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; - aagl.url = "github:ezKEa/aagl-gtk-on-nix"; + nixpkgs-vicuna.url = "github:NixOS/nixpkgs/release-24.11"; + home-manager-vicuna.url = "github:nix-community/home-manager/release-24.11"; + home-manager-vicuna.inputs.nixpkgs.follows = "nixpkgs-vicuna"; + + agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; + aagl.url = "github:ezKEa/aagl-gtk-on-nix"; catppuccin.url = "github:catppuccin/nix/8eada392fd6571a747e1c5fc358dd61c14c8704e"; catppuccin.inputs.nixpkgs.follows = "nixpkgs"; catppuccin-palette = { url = "github:catppuccin/palette"; flake = false; }; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + neovim-nightly.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly.inputs.nixpkgs.follows = "nixpkgs"; nix-gaming.url = "github:fufexan/nix-gaming"; @@ -35,7 +39,7 @@ wine-discord-ipc-bridge = { url = "github:0e4ef622/wine-discord-ipc-bridge"; flake = false; }; }; - outputs = { self, agenix, catppuccin, nixpkgs, ... } @ inputs: + outputs = { self, agenix, catppuccin, nixpkgs, nixpkgs-vicuna, ... } @ inputs: let overlays = (import ./overlays) ++ [(final: prev: { @@ -69,6 +73,7 @@ in { nixosConfigurations."anemone" = mkSystem nixpkgs "anemone" "x86_64-linux" []; + nixosConfigurations."hazel" = mkSystem nixpkgs-vicuna "hazel" "x86_64-linux" []; nixosConfigurations."hyacinth" = mkSystem nixpkgs "hyacinth" "x86_64-linux" []; packages."x86_64-linux" = diff --git a/hosts/hazel/default.nix b/hosts/hazel/default.nix new file mode 100644 index 0000000..94a4764 --- /dev/null +++ b/hosts/hazel/default.nix @@ -0,0 +1,22 @@ +{ modules, ... }: { + networking.hostName = "hazel"; + system.stateVersion = "24.11"; + time.timeZone = "Australia/Melbourne"; + + imports = with modules.system; [ + home-manager + + base + kernel + nix-stable + packages + security + + ./filesystem.nix + ./kernel.nix + ./networking.nix + ./packages.nix + + ../../users/hana + ]; +} diff --git a/hosts/hazel/filesystem.nix b/hosts/hazel/filesystem.nix new file mode 100644 index 0000000..525bb4a --- /dev/null +++ b/hosts/hazel/filesystem.nix @@ -0,0 +1,53 @@ +{ ... }: +let + mkLabelMount = label: type: options: { + device = "/dev/disk/by-label/${label}"; + fsType = type; + options = options; + }; + mkBtrfsMount = name: ext: subvol: atime: mkLabelMount name "btrfs" + [ + "autodefrag" + "compress=zstd:4" + "compress-force=zstd:4" + "defaults" + "nossd" + "space_cache=v2" + "subvol=${subvol}" + (if atime then "relatime" else "noatime") + ] ++ ext; + + mkHazelMount = mkBtrfsMount "HAZEL" [ "noauto" ]; +in +{ + boot.supportedFilesystems = [ "btrfs" ]; + fileSystems = { + "/" = { + device = "rootfs"; + fsType = "tmpfs"; + options = [ "defaults" "mode=755" ]; + }; + "/boot" = mkLabelMount "ROOT" "vfat" []; + + "/flower" = mkHazelMount "/current/flower" true; + "/persist" = mkHazelMount "/current/persist" true; + "/var" = mkHazelMount "/current/var" true; + "/nix" = mkHazelMount "/current/nix" false; + + "/mnt" = mkHazelMount "/" true; + }; + + services.snapper.cleanupInterval = "1h"; + services.snapper.configs.flower = { + FSTYPE = "btrfs"; + SUBVOLUME = "/mnt/current/flower"; + TIMELINE_CLEANUP = true; + TIMELINE_CREATE = true; + TIMELINE_MIN_AGE = "1800"; + TIMELINE_LIMIT_HOURLY = "5"; + TIMELINE_LIMIT_DAILY = "7"; + TIMELINE_LIMIT_WEEKLY = "0"; + TIMELINE_LIMIT_MONTHLY = "0"; + TIMELINE_LIMIT_YEARLY = "0"; + }; +} diff --git a/hosts/hazel/fs-decrypt.nix b/hosts/hazel/fs-decrypt.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/hazel/kernel.nix b/hosts/hazel/kernel.nix new file mode 100644 index 0000000..20be1ed --- /dev/null +++ b/hosts/hazel/kernel.nix @@ -0,0 +1,10 @@ +{ ... }: { + boot = { + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + }; + initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + kernelModules = [ "kvm-amd" ]; + }; +} diff --git a/hosts/hazel/networking.nix b/hosts/hazel/networking.nix new file mode 100644 index 0000000..1dd932a --- /dev/null +++ b/hosts/hazel/networking.nix @@ -0,0 +1,5 @@ +{ config, ... }: { + networking = { + useDHCP = true; + }; +} diff --git a/modules/system/home-manager-stable.nix b/modules/system/home-manager-stable.nix new file mode 100644 index 0000000..6f9f9cc --- /dev/null +++ b/modules/system/home-manager-stable.nix @@ -0,0 +1,19 @@ +{ config, inputs, modules, ... }: { + imports = [ + inputs.home-manager-vicuna.nixosModules.home-manager + ]; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs modules; + sysConfig = config; + }; + sharedModules = [ + { + imports = [ modules.options ]; + config.me = config.me; + } + ]; + }; +} diff --git a/users/hana/default.nix b/users/hana/default.nix index 25cfc8b..a895181 100644 --- a/users/hana/default.nix +++ b/users/hana/default.nix @@ -7,8 +7,7 @@ uid = 1002; hashedPassword = "$y$j9T$3xCNDudmfrIu5VfQQoDkj/$ugzJWq0gORN9jnhDsREu31CkL3zwniQu6KoLbmg6Wr/"; openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPru5eTBvHJ4ZmrrzPRHCGM09wQP/ZHSaKYalDuBVO15 rin@blossom" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ5l9t8dc6mPsKKYqZlPKvhOdyqz+DS5UOcvHuh3uVGt @strawberry" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPru5eTBvHJ4ZmrrzPRHCGM09wQP/ZHSaKYalDuBVO15 rin@anemone" ]; }; @@ -16,7 +15,7 @@ home = { username = "hana"; homeDirectory = "/home/hana"; - stateVersion = "23.11"; + stateVersion = "24.11"; }; imports = with modules.user; [