diff --git a/flake.lock b/flake.lock index 2bf5fc6..0cc7d68 100644 --- a/flake.lock +++ b/flake.lock @@ -32,27 +32,6 @@ "type": "github" } }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -71,82 +50,48 @@ "type": "github" } }, - "git-hooks-nix": { + "flake-utils-plus": { "inputs": { - "flake-compat": [ - "nix" - ], - "gitignore": [ - "nix" - ], - "nixpkgs": [ - "nix", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nix", - "nixpkgs" - ] + "flake-utils": "flake-utils_2" }, "locked": { - "lastModified": 1721042469, - "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "lastModified": 1715533576, + "narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", "type": "github" }, "original": { - "owner": "cachix", - "repo": "git-hooks.nix", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", "type": "github" } }, - "libgit2": { - "flake": false, - "locked": { - "lastModified": 1715853528, - "narHash": "sha256-J2rCxTecyLbbDdsyBWn9w7r3pbKRMkI9E7RvRgAqBdY=", - "owner": "libgit2", - "repo": "libgit2", - "rev": "36f7e21ad757a3dacc58cf7944329da6bc1d6e96", - "type": "github" - }, - "original": { - "owner": "libgit2", - "ref": "v1.8.1", - "repo": "libgit2", - "type": "github" - } - }, - "nix": { + "flake-utils_2": { "inputs": { - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "git-hooks-nix": "git-hooks-nix", - "libgit2": "libgit2", - "nixpkgs": "nixpkgs", - "nixpkgs-23-11": "nixpkgs-23-11", - "nixpkgs-regression": "nixpkgs-regression" + "systems": "systems_2" }, "locked": { - "lastModified": 1726840928, - "narHash": "sha256-kXJvsJwtf03lb1TNgWDg14wuFTUz+BpwcjuQmVIItGM=", - "owner": "NixOS", - "repo": "nix", - "rev": "68ba6ff4709d936c1a714de35da08f8ed354c710", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { - "id": "nix", - "type": "indirect" + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } }, "nixos-wsl": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1726981058, @@ -164,54 +109,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1723688146, - "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-23-11": { - "locked": { - "lastModified": 1717159533, - "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1726320982, "narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=", @@ -227,13 +124,13 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { - "lastModified": 1726755586, - "narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=", + "lastModified": 1728241625, + "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e", + "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", "type": "github" }, "original": { @@ -245,9 +142,31 @@ }, "root": { "inputs": { - "nix": "nix", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2", + "snowfall-lib": "snowfall-lib" + } + }, + "snowfall-lib": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719005984, + "narHash": "sha256-mpFl3Jv4fKnn+5znYXG6SsBjfXHJdRG5FEqNSPx0GLA=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "c6238c83de101729c5de3a29586ba166a9a65622", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" } }, "systems": { @@ -264,6 +183,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3cbc479..9cf53f3 100644 --- a/flake.nix +++ b/flake.nix @@ -2,110 +2,63 @@ description = "Nixos config flake test"; inputs = { + # nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + # Snowfallorg's Flake utility + snowfall-lib = { + url = "github:snowfallorg/lib"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, nixos-wsl, nix, ... }@inputs: - let - system = - if builtins ? currentSystem - then builtins.currentSystem - else "x86_64-linux"; - pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; - installedPackages = (import ./installed-packages { inherit pkgs; }); - in - { - nixosConfigurations.drivebystation-nixos-wsl = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - nixos-wsl.nixosModules.default - ./systems/drivebystation-nixos-wsl/configuration.nix - { - system.stateVersion = "24.05"; - wsl.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - environment.systemPackages = [ - ] - ++ installedPackages.mkPackages.packages; - programs.nix-ld = { - enable = true; - package = pkgs.nix-ld-rs; - }; - } - ]; - specialArgs = { inherit inputs; }; + outputs = inputs: + inputs.snowfall-lib.mkFlake { + inherit inputs; + src = ./.; + + # Configure Snowfall Lib, all of these settings are optional. + snowfall = { + # Tell Snowfall Lib to look in the `./nix/` directory for your + # Nix files. + root = ./.; + + # Choose a namespace to use for your flake's packages, library, + # and overlays. + namespace = "my-namespace"; + + # Add flake metadata that can be processed by tools like Snowfall Frost. + meta = { + # A slug to use in documentation when displaying things like file paths. + name = "nixos-config-hionv"; + + # A title to show for your flake, typically the name. + title = "Hion's Personal NixOS Config"; + }; }; - nixosConfigurations.th0nkpad-nixos = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - ./systems/th0nkpad-nixos/configuration.nix - { - system.stateVersion = "24.05"; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.andreas = { - isNormalUser = true; - description = "Andreas"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - flatpak - gnome-software - soundwireserver - vscode - spotify - # thunderbird - ]; - }; + + systems.modules.nixos = with inputs; [ + # my-input.nixosModules.my-module + ]; + + # The attribute set specified here will be passed directly to NixPkgs when + # instantiating the package set. + channels-config = { + # Allow unfree packages. + allowUnfree = true; + + # # Allow certain insecure packages + # permittedInsecurePackages = [ + # "firefox-100.0.0" + # ]; + + # # Additional configuration for specific packages. + # config = { + # # For example, enable smartcard support in Firefox. + # firefox.smartcardSupport = true; + # }; - # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ - 59010 #SoundWireServer - 3389 #RDP - ]; - networking.firewall.allowedUDPPorts = [ - 59010 #SoundWireServer - 3389 #RDP - ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Install firefox. - programs.firefox.enable = true; - - # Set up system Packages - environment.systemPackages = with pkgs; [ - git - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - ] - ++ installedPackages.mkPackages.packages; - programs.nix-ld = { - enable = true; - package = pkgs.nix-ld-rs; - }; - services.flatpak.enable = true; - systemd.services.flatpak-repo = { - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.flatpak ]; - script = '' - flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - ''; - }; - # services.xrdp.enable = true; - # services.xrdp.defaultWindowManager = "${pkgs.gnome-session}/bin/gnome-session"; - # services.xrdp.openFirewall = true; - - # Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI! - # If no user is logged in, the machine will power down after 20 minutes. - systemd.targets.sleep.enable = false; - systemd.targets.suspend.enable = false; - systemd.targets.hibernate.enable = false; - systemd.targets.hybrid-sleep.enable = false; - } - ]; - specialArgs = { inherit inputs; }; }; }; } diff --git a/installed-packages/default.nix b/installed-packages/default.nix deleted file mode 100644 index 7c6bb3a..0000000 --- a/installed-packages/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs }: -let - baseBackages = [ - pkgs.vim - pkgs.nixpkgs-fmt - ]; - utilPackages = [ - pkgs.wget - pkgs.curl - pkgs.git - pkgs.ffmpeg - ]; - haxeDevelopmentPackages = [ - pkgs.haxe - ]; -in -{ - mkPackages = { - packages = baseBackages ++ utilPackages ++ haxeDevelopmentPackages; - }; -} diff --git a/lib/installed-packages/default.nix b/lib/installed-packages/default.nix new file mode 100644 index 0000000..4bdf818 --- /dev/null +++ b/lib/installed-packages/default.nix @@ -0,0 +1,45 @@ +{ + # This is the merged library containing your namespaced library as well as all libraries from + # your flake's inputs. + lib +, # Your flake inputs are also available. + inputs +, # The namespace used for your flake, defaulting to "internal" if not set. + namespace +, # Additionally, Snowfall Lib's own inputs are passed. You probably don't need to use this! + snowfall-inputs +, ... +}: + +{ + # This will be available as `lib.my-namespace.mkPackages`. + mkPackages = {pkgs, ...}: + let + inherit pkgs; + # pkgs = namespace.; + # pkgs = snowfall-inputs.nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; }; + baseBackages = [ + pkgs.vim + pkgs.nixpkgs-fmt + ]; + utilPackages = [ + pkgs.wget + pkgs.curl + pkgs.git + pkgs.ffmpeg + ]; + haxeDevelopmentPackages = [ + pkgs.haxe + ]; + in + { + packages = baseBackages ++ utilPackages ++ haxeDevelopmentPackages; + }; + + # my-scope = { + # # This will be available as `lib.my-namespace.my-scope.my-scoped-helper-function`. + # my-scoped-helper-function = x: x; + # }; +} + + diff --git a/systems/drivebystation-nixos-wsl/default.nix b/systems/drivebystation-nixos-wsl/default.nix deleted file mode 100644 index e69de29..0000000 diff --git a/systems/th0nkpad-nixos/default.nix b/systems/th0nkpad-nixos/default.nix deleted file mode 100644 index e69de29..0000000 diff --git a/systems/drivebystation-nixos-wsl/configuration.nix b/systems/x86_64-linux/drivebystation-nixos-wsl/configuration.nix similarity index 100% rename from systems/drivebystation-nixos-wsl/configuration.nix rename to systems/x86_64-linux/drivebystation-nixos-wsl/configuration.nix diff --git a/systems/x86_64-linux/drivebystation-nixos-wsl/default.nix b/systems/x86_64-linux/drivebystation-nixos-wsl/default.nix new file mode 100644 index 0000000..d0a71ea --- /dev/null +++ b/systems/x86_64-linux/drivebystation-nixos-wsl/default.nix @@ -0,0 +1,47 @@ + + # nixosConfigurations.drivebystation-nixos-wsl = nixpkgs.lib.nixosSystem { + # + # }; + { + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the system system. + config, + ... +}: +{ + inherit system; + modules = [ + nixos-wsl.nixosModules.default + ./configuration.nix + { + system.stateVersion = "24.05"; + wsl.enable = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + environment.systemPackages = [ + + ] + ++ installedPackages.mkPackages.packages; + programs.nix-ld = { + enable = true; + package = pkgs.nix-ld-rs; + }; + } + ]; + specialArgs = { inherit inputs; }; + # Your configuration. +} \ No newline at end of file diff --git a/systems/th0nkpad-nixos/configuration.nix b/systems/x86_64-linux/th0nkpad-nixos/configuration.nix similarity index 100% rename from systems/th0nkpad-nixos/configuration.nix rename to systems/x86_64-linux/th0nkpad-nixos/configuration.nix diff --git a/systems/x86_64-linux/th0nkpad-nixos/default.nix b/systems/x86_64-linux/th0nkpad-nixos/default.nix new file mode 100644 index 0000000..8d59cd0 --- /dev/null +++ b/systems/x86_64-linux/th0nkpad-nixos/default.nix @@ -0,0 +1,102 @@ +# nixosConfigurations.th0nkpad-nixos = nixpkgs.lib.nixosSystem { + +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib +, # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs +, # You also have access to your flake's inputs. + inputs +, # Additional metadata is provided by Snowfall Lib. + namespace +, # The namespace used for your flake, defaulting to "internal" if not set. + system +, # The system architecture for this host (eg. `x86_64-linux`). + target +, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format +, # A normalized name for the system target (eg. `iso`). + virtual +, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems +, # An attribute map of your defined hosts. + + # All other arguments come from the system system. + config +, ... +}: +let + inherit pkgs; + installedPackages = lib.my-namespace.mkPackages pkgs; +in +{ + # inherit system; + imports = [ + ./configuration.nix + ]; + config = { + system.stateVersion = "24.05"; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.andreas = { + isNormalUser = true; + description = "Andreas"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + flatpak + gnome-software + soundwireserver + vscode + spotify + # thunderbird + ]; + }; + + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 59010 #SoundWireServer + 3389 #RDP + ]; + networking.firewall.allowedUDPPorts = [ + 59010 #SoundWireServer + 3389 #RDP + ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Install firefox. + programs.firefox.enable = true; + + # Set up system Packages + environment.systemPackages = with pkgs; [ + git + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ] + ++ installedPackages.packages; + programs.nix-ld = { + enable = true; + package = pkgs.nix-ld-rs; + }; + services.flatpak.enable = true; + systemd.services.flatpak-repo = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + # services.xrdp.enable = true; + # services.xrdp.defaultWindowManager = "${pkgs.gnome-session}/bin/gnome-session"; + # services.xrdp.openFirewall = true; + + # Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI! + # If no user is logged in, the machine will power down after 20 minutes. + systemd.targets.sleep.enable = false; + systemd.targets.suspend.enable = false; + systemd.targets.hibernate.enable = false; + systemd.targets.hybrid-sleep.enable = false; + }; + } diff --git a/systems/th0nkpad-nixos/hardware-configuration.nix b/systems/x86_64-linux/th0nkpad-nixos/hardware-configuration.nix similarity index 100% rename from systems/th0nkpad-nixos/hardware-configuration.nix rename to systems/x86_64-linux/th0nkpad-nixos/hardware-configuration.nix