diff --git a/.gitignore b/.gitignore index cfbf59b..dbee5b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /result -*.qcow2 \ No newline at end of file +*.qcow2 diff --git a/checks/fmt.nix b/checks/fmt.nix index a40a950..35e62a4 100644 --- a/checks/fmt.nix +++ b/checks/fmt.nix @@ -1,6 +1,5 @@ { mkTest, - pkgs, lib, self, alejandra, diff --git a/checks/module.nix b/checks/module.nix index dab7154..93c03b9 100644 --- a/checks/module.nix +++ b/checks/module.nix @@ -3,7 +3,7 @@ pkgs, lib, ... - } @ args: let + }: let inherit (lib) callPackageWith; mkTest = test: diff --git a/flake.lock b/flake.lock index b218c5e..3a2fd2c 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1720211568, - "narHash": "sha256-Uph6rcbiuOD6bGEySonDFozdO+mznTug08x27WG4BIg=", + "lastModified": 1719675517, + "narHash": "sha256-QXMYL1ay66M7T/JdaO4wR8K58GkV5CNN8U15gwifdbY=", "owner": "ezkea", "repo": "aagl-gtk-on-nix", - "rev": "ce7e02b20fe45425bbdbebc6fe0fdcc018c9efc6", + "rev": "4688aa9f107d6d7ac46a98a01f7105cac8e7dbe6", "type": "github" }, "original": { @@ -74,11 +74,11 @@ "base16-helix": { "flake": false, "locked": { - "lastModified": 1720809814, - "narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=", + "lastModified": 1696727917, + "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", "owner": "tinted-theming", "repo": "base16-helix", - "rev": "34f41987bec14c0f3f6b2155c19787b1f6489625", + "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", "type": "github" }, "original": { @@ -163,11 +163,11 @@ ] }, "locked": { - "lastModified": 1720661479, - "narHash": "sha256-nsGgA14vVn0GGiqEfomtVgviRJCuSR3UEopfP8ixW1I=", + "lastModified": 1719733833, + "narHash": "sha256-6h2EqZU9bL9rHlXE+2LCBgnDImejzbS+4dYsNDDFlkY=", "owner": "nix-community", "repo": "disko", - "rev": "786965e1b1ed3fd2018d78399984f461e2a44689", + "rev": "d185770ea261fb5cf81aa5ad1791b93a7834d12c", "type": "github" }, "original": { @@ -184,11 +184,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1720852044, - "narHash": "sha256-3NBYz8VuXuKU+8ONd9NFafCNjPEGHIZQ2Mdoam1a4mY=", + "lastModified": 1719815435, + "narHash": "sha256-K2xFp142onP35jcx7li10xUxNVEVRWjAdY8DSuR7Naw=", "owner": "nix-community", "repo": "fenix", - "rev": "5087b12a595ee73131a944d922f24d81dae05725", + "rev": "ebfe2c639111d7e82972a12711206afaeeda2450", "type": "github" }, "original": { @@ -234,11 +234,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "lastModified": 1719745305, + "narHash": "sha256-xwgjVUpqSviudEkpQnioeez1Uo2wzrsMaJKJClh+Bls=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "rev": "c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9", "type": "github" }, "original": { @@ -336,11 +336,11 @@ }, "hardware": { "locked": { - "lastModified": 1720737798, - "narHash": "sha256-G/OtEAts7ZUvW5lrGMXSb8HqRp2Jr9I7reBuvCOL54w=", + "lastModified": 1719681865, + "narHash": "sha256-Lp+l1IsREVbz8WM35OJYZz8sAH0XOjrZWUXVB5bJ2qg=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "c5013aa7ce2c7ec90acee5d965d950c8348db751", + "rev": "a59f00f5ac65b19382617ba00f360f8bc07ed3ac", "type": "github" }, "original": { @@ -359,11 +359,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1720645896, - "narHash": "sha256-7rJXoGf3kMsteTRHPN07UnQ25pIG0UCf3RfNCQDLw+w=", + "lastModified": 1719679146, + "narHash": "sha256-GG2EACfqQleZjJXBPMiLf/fhy091kP4OuSJrDzddJuE=", "owner": "mattwparas", "repo": "helix", - "rev": "25a8f033de85b2f14b3dd5eb4ca1a0388ca9231c", + "rev": "4a8c4fbea51d1eb1a90e9f1a1e0edd5b71868b67", "type": "github" }, "original": { @@ -380,11 +380,11 @@ ] }, "locked": { - "lastModified": 1720734513, - "narHash": "sha256-neWQ8eNtLTd+YMesb7WjKl1SVCbDyCm46LUgP/g/hdo=", + "lastModified": 1719677234, + "narHash": "sha256-qO9WZsj/0E6zcK4Ht1y/iJ8XfwbBzq7xdqhBh44OP/M=", "owner": "nix-community", "repo": "home-manager", - "rev": "90ae324e2c56af10f20549ab72014804a3064c7f", + "rev": "36317d4d38887f7629876b0e43c8d9593c5cc48d", "type": "github" }, "original": { @@ -416,11 +416,11 @@ ] }, "locked": { - "lastModified": 1720294664, - "narHash": "sha256-YEhAWWXBjWUfzrcG1gvsiQOpih+KMnNWPhDZYgzWeYo=", + "lastModified": 1719800606, + "narHash": "sha256-rMzrtuTFcQr0N9JBoRD6PXgAi5RMmlyzjM6rur5OWTk=", "owner": "passivelemon", "repo": "lemonake", - "rev": "44a6c6fb81734bd2d8edc47239ff83d60edb66bb", + "rev": "e180acbc08a54dfa656ea08d9500dfdd53abb91c", "type": "github" }, "original": { @@ -436,11 +436,11 @@ ] }, "locked": { - "lastModified": 1720845312, - "narHash": "sha256-yPhAsJTpyoIPQZJGC8Fw8W2lAXyhLoTn+HP20bmfkfk=", + "lastModified": 1719128254, + "narHash": "sha256-I7jMpq0CAOZA/i70+HDQO/ulLttyQu/K70cSESiMX7A=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "5ce8503cf402cf76b203eba4b7e402bea8e44abc", + "rev": "50581970f37f06a4719001735828519925ef8310", "type": "github" }, "original": { @@ -456,11 +456,11 @@ ] }, "locked": { - "lastModified": 1720334033, - "narHash": "sha256-X9pEvvHTVWJphhbUYqXvlLedOndNqGB7rvhSvL2CIgU=", + "lastModified": 1719726405, + "narHash": "sha256-DqeKlvYQ5Z1rC02we9ufHr8UTfqBRPhiPrGLqdJ91dQ=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "685e40e1348007d2cf76747a201bab43d86b38cb", + "rev": "838a910df0f7e542de2327036b2867fd68ded3a2", "type": "github" }, "original": { @@ -487,14 +487,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1719876945, - "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" } }, "nixpkgs-lib_2": { @@ -531,11 +531,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1720717809, - "narHash": "sha256-6I+fm+nTLF/iaj7ffiFGlSY7POmubwUaPA/Wq0Bm53M=", + "lastModified": 1719760370, + "narHash": "sha256-fsxAuW6RxKZYjAP3biUC6C4vaYFhDfWv8lp1Tmx3ZCY=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "ffbc5ad993d5cd2f3b8bcf9a511165470944ab91", + "rev": "ea7fdada6a0940b239ddbde2048a4d7dac1efe1e", "type": "github" }, "original": { @@ -598,11 +598,11 @@ ] }, "locked": { - "lastModified": 1720452154, - "narHash": "sha256-mBsTjBMlhaIcDOQuKQ1yGhf0mgimB652k9DLUDOGKNo=", + "lastModified": 1719161502, + "narHash": "sha256-PPNCexmCC7h94atd7INIZcC3Tkc9ftbijxaR2sUzlms=", "owner": "mattwparas", "repo": "steel", - "rev": "a3625da0e5bdd32646ab917054bbe0d0946aa7b0", + "rev": "a818390fbbf9beb681b75494a2b1025a5070684e", "type": "github" }, "original": { @@ -630,11 +630,11 @@ ] }, "locked": { - "lastModified": 1720818679, - "narHash": "sha256-u9PqY7O6TN42SLeb0e6mnYAgQOoQmclaVSHfLKMpmu0=", + "lastModified": 1719525570, + "narHash": "sha256-xSO/H67GAHEW0siD2PHoO/e97MbROL3r3s5SpF6A6Dc=", "owner": "danth", "repo": "stylix", - "rev": "29148118cc33f08b71058e1cda7ca017f5300b51", + "rev": "1ff9d37d27377bfe8994c24a8d6c6c1734ffa116", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f00bcee..913f9fa 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,9 @@ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; hardware.url = "github:nixos/nixos-hardware"; + flake-parts.url = "github:hercules-ci/flake-parts"; + impermanence.url = "github:nix-community/impermanence"; disko.url = "github:nix-community/disko"; @@ -46,8 +48,8 @@ outputs = {flake-parts, ...} @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { systems = [ - "aarch64-linux" "aarch64-darwin" + "aarch64-linux" "x86_64-darwin" "x86_64-linux" ]; @@ -55,13 +57,18 @@ imports = [ ./apps/module.nix ./checks/module.nix + ./lib/module.nix ./modules/module.nix ./overlays/module.nix ./pkgs/module.nix ./systems/module.nix ]; - perSystem = {pkgs, ...}: { + perSystem = { + pkgs, + inputs', + ... + }: { formatter = pkgs.alejandra; }; }; diff --git a/lib/module.nix b/lib/module.nix new file mode 100644 index 0000000..144d57f --- /dev/null +++ b/lib/module.nix @@ -0,0 +1,42 @@ +{ + self, + lib, + inputs, + withSystem, + ... +}: let + inherit (self) outputs; + inherit (lib.strings) hasSuffix; +in { + flake.lib = rec { + mkPkgs = system: + import inputs.nixpkgs { + inherit system; + overlays = with outputs.overlays; [pkgs]; + config.allowUnfree = true; + }; + + mkSystem = host: system: type: modules: + withSystem system ({pkgs, ...}: + type { + inherit system modules; + pkgs = mkPkgs system; + specialArgs = {inherit inputs outputs host;}; + }); + + mkStrappedSystem = host: system: type: modules: let + inherit (builtins) attrValues; + + isLinux = hasSuffix "linux" system; + in + mkSystem host system type ( + modules + ++ ( + if isLinux + then attrValues outputs.nixosModules + else attrValues outputs.darwinModules + ) + ++ attrValues outputs.sharedModules + ); + }; +} diff --git a/modules/darwin/home-manager/default.nix b/modules/darwin/home-manager/default.nix index 121b122..42af969 100644 --- a/modules/darwin/home-manager/default.nix +++ b/modules/darwin/home-manager/default.nix @@ -16,7 +16,7 @@ in { options.sysc.home-manager = { enable = mkOption { type = types.bool; - default = true; + default = false; description = "Whether to enable home-manager."; }; }; @@ -28,7 +28,6 @@ in { users.bddvlpr = import ./users/bddvlpr.nix; extraSpecialArgs = { inherit inputs outputs system; - nixosConfig = config; }; }; }; diff --git a/modules/home/cura/default.nix b/modules/home/cura/default.nix new file mode 100644 index 0000000..5159240 --- /dev/null +++ b/modules/home/cura/default.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.sysc.cura; +in { + options.sysc.cura = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable Cura."; + }; + }; + + config = mkIf cfg.enable { + home = { + packages = with pkgs; [cura]; + + persistence."/persist/home/bddvlpr".directories = [ + ".config/cura" + ".local/share/cura" + ]; + }; + }; +} diff --git a/modules/home/freecad/default.nix b/modules/home/freecad/default.nix index 1c85fe3..d9f2fab 100644 --- a/modules/home/freecad/default.nix +++ b/modules/home/freecad/default.nix @@ -11,7 +11,7 @@ in { options.sysc.freecad = { enable = mkOption { type = types.bool; - default = true; + default = false; description = "Whether to enable FreeCAD."; }; }; diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix index 320b452..c2b5616 100644 --- a/modules/home/hyprland/default.nix +++ b/modules/home/hyprland/default.nix @@ -46,6 +46,10 @@ in { border_size = 2; }; + cursor = { + no_hardware_cursors = true; + }; + input = { sensitivity = -0.50; follow_mouse = 2; @@ -58,10 +62,12 @@ in { windowrulev2 = let steam = "title:^()$,class:^(steam)$"; steamapp = "class:^(steam_app)"; + cura_launcher = "title:^(cura)$"; in [ "stayfocused, ${steam}" "minsize 1 1, ${steam}" "tile, ${steamapp}" + "float, ${cura_launcher}" ]; bind = let diff --git a/modules/home/impermanence/default.nix b/modules/home/impermanence/default.nix index a6bbc10..3d6bcd4 100644 --- a/modules/home/impermanence/default.nix +++ b/modules/home/impermanence/default.nix @@ -6,6 +6,8 @@ in { config.home.persistence."/persist/home/bddvlpr" = { allowOther = true; directories = [ + ".config/sops" + ".ssh" "Documents" "Pictures" "Videos" diff --git a/modules/home/opencomposite/default.nix b/modules/home/opencomposite/default.nix index f742f3d..c9a3d3c 100644 --- a/modules/home/opencomposite/default.nix +++ b/modules/home/opencomposite/default.nix @@ -1,35 +1,50 @@ { - pkgs, + lib, config, + pkgs, ... -}: { - xdg.configFile."openxr/1/active_runtime.json".text = '' - { - "file_format_version": "1.0.0", - "runtime": { - "name": "Monado", - "library_path": "${pkgs.monado}/lib/libopenxr_monado.so" +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.sysc.opencomposite; +in { + options.sysc.opencomposite = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable opencomposite."; + }; + }; + + config = mkIf cfg.enable { + xdg.configFile."openxr/1/active_runtime.json".text = '' + { + "file_format_version": "1.0.0", + "runtime": { + "name": "Monado", + "library_path": "${pkgs.monado}/lib/libopenxr_monado.so" + } } - } - ''; + ''; - xdg.configFile."openvr/openvrpaths.vrpath".text = '' - { - "config" : - [ - "${config.xdg.dataHome}/Steam/config" - ], - "external_drivers" : null, - "jsonid" : "vrpathreg", - "log" : - [ - "${config.xdg.dataHome}/Steam/logs" - ], - "runtime" : - [ - "${pkgs.opencomposite}/lib/opencomposite" - ], - "version" : 1 - } - ''; + xdg.configFile."openvr/openvrpaths.vrpath".text = '' + { + "config" : + [ + "${config.xdg.dataHome}/Steam/config" + ], + "external_drivers" : null, + "jsonid" : "vrpathreg", + "log" : + [ + "${config.xdg.dataHome}/Steam/logs" + ], + "runtime" : + [ + "${pkgs.opencomposite}/lib/opencomposite" + ], + "version" : 1 + } + ''; + }; } diff --git a/modules/home/stylix/default.nix b/modules/home/stylix/default.nix index 650e7d4..eba0b9e 100644 --- a/modules/home/stylix/default.nix +++ b/modules/home/stylix/default.nix @@ -9,7 +9,7 @@ in { stylix = { enable = true; - image = ./wallpaper.jpeg; + image = ./wallpaper.jpg; polarity = "dark"; diff --git a/modules/home/stylix/wallpaper.jpeg b/modules/home/stylix/wallpaper.jpeg deleted file mode 100644 index c85112d..0000000 Binary files a/modules/home/stylix/wallpaper.jpeg and /dev/null differ diff --git a/modules/home/stylix/wallpaper.jpg b/modules/home/stylix/wallpaper.jpg new file mode 100644 index 0000000..7b52256 Binary files /dev/null and b/modules/home/stylix/wallpaper.jpg differ diff --git a/modules/nixos/avahi/default.nix b/modules/nixos/avahi/default.nix new file mode 100644 index 0000000..225b4d1 --- /dev/null +++ b/modules/nixos/avahi/default.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.sysc.avahi; +in { + options.sysc.avahi = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable avahi resolving."; + }; + }; + + config = mkIf cfg.enable { + services.avahi.enable = true; + }; +} diff --git a/modules/nixos/impermanence/default.nix b/modules/nixos/impermanence/default.nix index 0d7d8a4..56309d9 100644 --- a/modules/nixos/impermanence/default.nix +++ b/modules/nixos/impermanence/default.nix @@ -25,6 +25,7 @@ in { enable = cfg.enable; directories = [ "/etc/nixos" + "/etc/ssh" "/var/log" ]; }; diff --git a/modules/nixos/libvirtd/default.nix b/modules/nixos/libvirtd/default.nix new file mode 100644 index 0000000..71293c4 --- /dev/null +++ b/modules/nixos/libvirtd/default.nix @@ -0,0 +1,38 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.sysc.libvirtd; +in { + options.sysc.libvirtd = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable libvirtd."; + }; + }; + + config = mkIf cfg.enable { + virtualisation.libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + }; + }; + + boot.binfmt.emulatedSystems = [ + "aarch64-linux" + ]; + + environment.persistence."/persist" = { + hideMounts = true; + directories = [ + "/var/lib/libvirt" + ]; + }; + }; +} diff --git a/modules/nixos/nvidia/default.nix b/modules/nixos/nvidia/default.nix index dbc5c4b..f419650 100644 --- a/modules/nixos/nvidia/default.nix +++ b/modules/nixos/nvidia/default.nix @@ -17,7 +17,7 @@ in { enableBeta = mkOption { type = types.bool; - default = false; + default = true; description = "Whether to enable the beta driver."; }; }; diff --git a/modules/nixos/tailscale/default.nix b/modules/nixos/tailscale/default.nix new file mode 100644 index 0000000..0f7819c --- /dev/null +++ b/modules/nixos/tailscale/default.nix @@ -0,0 +1,25 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.sysc.tailscale; +in { + options.sysc.tailscale = { + enable = mkOption { + type = types.bool; + default = true; + description = "Whether to enable tailscale."; + }; + }; + + config = mkIf cfg.enable { + services.tailscale.enable = true; + + environment.persistence."/persist".directories = [ + "/var/lib/tailscale" + ]; + }; +} diff --git a/systems/dissension/default.nix b/systems/dissension/default.nix index c33ba01..3868c84 100644 --- a/systems/dissension/default.nix +++ b/systems/dissension/default.nix @@ -1,7 +1,9 @@ { sysc = { aagl.enable = true; + avahi.enable = true; docker.enable = true; + libvirtd.enable = true; }; system.stateVersion = "24.05"; diff --git a/systems/module.nix b/systems/module.nix index 94d7659..8f8eb06 100644 --- a/systems/module.nix +++ b/systems/module.nix @@ -1,56 +1,34 @@ { self, - inputs, lib, - withSystem, + inputs, ... }: let inherit (self) outputs; + inherit (outputs.lib) mkStrappedSystem; + inherit (lib) mkMerge; inherit (inputs.nixpkgs.lib) nixosSystem; + inherit (inputs.nix-darwin.lib) darwinSystem; - mkPkgs = system: - import inputs.nixpkgs { - inherit system; - overlays = with outputs.overlays; [pkgs]; - config.allowUnfree = true; - }; - - mkNixOS = host: system: - withSystem system ({pkgs, ...}: { - "${host}" = nixosSystem { - inherit system; - pkgs = mkPkgs system; - specialArgs = {inherit inputs outputs host;}; - modules = - [ - ./${host} - ./${host}/hardware.nix - ] - ++ builtins.attrValues outputs.nixosModules - ++ builtins.attrValues outputs.sharedModules; - }; - }); + mkNixOS = host: system: { + "${host}" = mkStrappedSystem host system nixosSystem [ + ./${host} + ./${host}/hardware.nix + ]; + }; - mkDarwin = host: system: - withSystem system ({pkgs, ...}: { - "${host}" = inputs.nix-darwin.lib.darwinSystem { - inherit system; - pkgs = mkPkgs system; - specialArgs = {inherit inputs outputs host;}; - modules = - [] - ++ builtins.attrValues outputs.darwinModules - ++ builtins.attrValues outputs.sharedModules; - }; - }); + mkDarwin = host: system: { + "${host}" = + mkStrappedSystem host system darwinSystem []; + }; in { flake = { - nixosConfigurations = lib.mkMerge [ + nixosConfigurations = mkMerge [ (mkNixOS "dissension" "x86_64-linux") (mkNixOS "solaris" "x86_64-linux") ]; - darwinConfigurations = lib.mkMerge [ + darwinConfigurations = mkMerge [ (mkDarwin "lavender" "x86_64-darwin") ]; };