From ca61daf0850948c1549dbba5da3af4146f3b8644 Mon Sep 17 00:00:00 2001 From: sstent Date: Wed, 29 Nov 2023 19:49:09 +0000 Subject: [PATCH] new flake --- configuration.nix | 119 ----------- flake.lock | 179 +---------------- flake.nix | 190 ++++-------------- home-manager/{users/sstent => }/default.nix | 47 +++-- home-manager/global.nix | 36 ++-- .../{users/sstent => }/python-packages.nix | 0 hosts/common.nix | 101 +--------- hosts/commonold.nix | 179 ----------------- hosts/default.nix | 44 ++++ modules/default.nix | 10 + pkgs/default.nix | 18 +- 11 files changed, 171 insertions(+), 752 deletions(-) delete mode 100644 configuration.nix rename home-manager/{users/sstent => }/default.nix (85%) rename home-manager/{users/sstent => }/python-packages.nix (100%) delete mode 100644 hosts/commonold.nix create mode 100644 hosts/default.nix create mode 100644 modules/default.nix diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 3ecc363..0000000 --- a/configuration.nix +++ /dev/null @@ -1,119 +0,0 @@ -{self, ...} @ inputs: -with inputs; let - ## Variable Declaration ## - # Supported Architectures - platforms = ["x86_64-linux"]; - - # NixOS Version - version = readFile ./.version; - - # System Libraries - inherit (self) files; - inherit (lib) eachSystem filters; - inherit (builtins) head readFile; - inherit (lib.util) build map pack; - lib = library.lib.extend (final: prev: - { - inherit (flatpak.lib) flatpak; - deploy = deploy.lib; - filters = ignore.lib // {inherit (filter.lib) filter matchExt;}; - hooks = hooks.lib; - image = generators.nixosGenerate; - wine = wine.lib; - util = import ./lib { - inherit self platforms; - lib = final; - }; - } - // home.lib - // utils.lib); -in - eachSystem platforms (system: let - # Default Package Channel - pkgs = self.legacyPackages."${system}"; - - # Package Calling Function - call = name: pkgs.callPackage name {inherit lib inputs pkgs files;}; - in { - ## Configuration Checks ## - checks = import ./modules/nix/checks.nix {inherit self system lib;}; - - ## Developer Shells ## - devShells = - map.modules' ./shells (file: pkgs.mkShell (import file pkgs)) - // { - default = import ./shells {inherit pkgs;}; - website = import ./site/shell.nix {inherit pkgs;}; - commit = - pkgs.mkShell {inherit (self.checks."${system}".commit) shellHook;}; - }; - - ## Code Formatter ## - formatter = pkgs.treefmt; - - ## Package Configuration ## - legacyPackages = self.channels."${system}".stable; - - # Channels - channels = { - stable = (build.channel stable [] ./packages/patches)."${system}"; - unstable = (build.channel unstable [nur.overlay] [])."${system}"; - wine = wine.packages."${system}"; - gaming = gaming.packages."${system}"; - apps = { - deploy = deploy.defaultPackage."${system}"; - generators = generators.defaultPackage."${system}"; - }; - }; - - # Custom Packages - # apps = map.modules ./scripts (name: lib.mkApp {drv = call name;}) // {default = self.apps."${system}".nixos;}; - # packages = map.modules ./packages call // map.modules ./scripts call // {default = self.packages."${system}".dotfiles;}; - }) - // { - # Overrides - overlays = map.modules ./packages/overlays import; - - ## Custom Library Functions ## - lib = lib.util; - - ## Program Configuration and 'dotfiles' ## - # files = import ./files lib self.legacyPackages."${head platforms}"; - - ## Custom Configuration Modules ## - nixosModules = - map.modules ./modules import - // {default = import ./modules {inherit version lib inputs files;};}; - - ## Configuration Templates ## - # templates = import ./.templates lib; - - ## Device Configuration ## - # deploy = import ./modules/nix/deploy.nix {inherit self lib;}; - # nixosConfigurations = - # map.modules ./devices (name: build.device (import name)); - - nixosConfigurations = { - go3-wsl = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; - modules = [ - ./hosts/WSL/go3-wsl - ]; - }; - StuPC-WSL = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; - modules = [ - ./hosts/WSL/StuPC-WSL - ]; - }; - - }; - - - ## Virtual Machines ## - # vmConfigurations = - # map.modules ./devices/vm (name: - # import name (head platforms) inputs self.channels."${head platforms}".stable); - - }; - } \ No newline at end of file diff --git a/flake.lock b/flake.lock index 59fe99e..a59db65 100644 --- a/flake.lock +++ b/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "filter": { - "locked": { - "lastModified": 1694857738, - "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "41fd48e00c22b4ced525af521ead8792402de0ea", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -53,42 +38,6 @@ "inputs": { "systems": "systems_2" }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_4" - }, "locked": { "lastModified": 1681202837, "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", @@ -110,11 +59,11 @@ ] }, "locked": { - "lastModified": 1695108154, - "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=", + "lastModified": 1700392168, + "narHash": "sha256-v5LprEFx3u4+1vmds9K0/i7sHjT0IYGs7u9v54iz/OA=", "owner": "nix-community", "repo": "home-manager", - "rev": "07682fff75d41f18327a871088d20af2710d4744", + "rev": "28535c3a34d79071f2ccb68671971ce0c0984d7e", "type": "github" }, "original": { @@ -124,62 +73,10 @@ "type": "github" } }, - "ignore": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1694102001, - "narHash": "sha256-vky6VPK1n1od6vXbqzOXnekrQpTL4hbPAwUhT5J9c9E=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "9e21c80adf67ebcb077d75bd5e7d724d21eeafd6", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "library": { - "locked": { - "lastModified": 1674348806, - "narHash": "sha256-hKi7sFobRQg6sJxskRFCjt/d8gR+w0ClEWZatlr2rnw=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "af5239f892ae6e1c8bb560b11ed874cebbd10696", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "master", - "repo": "nixpkgs.lib", - "rev": "af5239f892ae6e1c8bb560b11ed874cebbd10696", - "type": "github" - } - }, - "nixos-hardware": { - "locked": { - "lastModified": 1696614066, - "narHash": "sha256-nAyYhO7TCr1tikacP37O9FnGr2USOsVBD3IgvndUYjM=", - "owner": "NixOS", - "repo": "nixos-hardware", - "rev": "bb2db418b616fea536b1be7f6ee72fb45c11afe0", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixos-hardware", - "type": "github" - } - }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" ] @@ -200,11 +97,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1696610053, - "narHash": "sha256-nMYt0iIt9OEdsP7XuNjwml+nweuHTWWx86f1t7Dp3FM=", + "lastModified": 1701268161, + "narHash": "sha256-hL4jGGwMHHmyx6G9wi6IrYa8RLkoEtzCb4zWITH1B40=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f49c3d6bb60a6317e4c5137d50299b5c93a8a64b", + "rev": "67be70a859530f6f7c358568eaa6ab0d84b36b01", "type": "github" }, "original": { @@ -232,11 +129,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1696375444, - "narHash": "sha256-Sv0ICt/pXfpnFhTGYTsX6lUr1SljnuXWejYTI2ZqHa4=", + "lastModified": 1701068326, + "narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=", "owner": "nixos", "repo": "nixpkgs", - "rev": "81e8f48ebdecf07aab321182011b067aafc78896", + "rev": "8cfef6986adfb599ba379ae53c9f5631ecd2fd9c", "type": "github" }, "original": { @@ -278,17 +175,11 @@ }, "root": { "inputs": { - "filter": "filter", - "flake-utils": "flake-utils", "home-manager": "home-manager", - "ignore": "ignore", - "library": "library", - "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix", - "utils": "utils", "vscode-server": "vscode-server" } }, @@ -341,57 +232,9 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "flake-utils": "flake-utils_3" - }, - "locked": { - "lastModified": 1696331477, - "narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "type": "github" - } - }, "vscode-server": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_3" }, "locked": { diff --git a/flake.nix b/flake.nix index 391666e..4b8b1b3 100644 --- a/flake.nix +++ b/flake.nix @@ -2,176 +2,68 @@ description = "Your new nix config"; inputs = { - # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; - # You can access packages and modules from different nixpkgs revs - # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. - - # Home manager home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; - nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings - # nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs";}; #import nixos-generators for building images + #nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings nixos-wsl = { url = "github:nix-community/nixos-wsl"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix.url = github:Mic92/sops-nix; - flake-utils.url = "github:numtide/flake-utils"; - # nix.url = "github:NixOS/nix/2.12.0"; vscode-server.url = "github:msteen/nixos-vscode-server"; - - # homeage = {url = "github:jordanisaacs/homeage"; inputs.nixpkgs.follows = "nixpkgs";}; - # Nix Library Functions - library = { - type = "github"; - owner = "nix-community"; - repo = "nixpkgs.lib"; - ref = "master"; - rev = "af5239f892ae6e1c8bb560b11ed874cebbd10696"; - }; - # Source Filter Functions - filter.url = "github:numtide/nix-filter"; - ignore = { - url = "github:hercules-ci/gitignore.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - # Flake Utility Functions - utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; }; - outputs = { - self, - nixpkgs, - home-manager, - nixpkgs-unstable, - ... - } @ inputs: let - inherit (lib.my) mapModules mapModulesRec mapHosts; - inherit (self) outputs; - - system = "x86_64-linux"; - - mkPkgs = pkgs: extraOverlays: - import pkgs { - inherit system; - config.allowUnfree = true; # forgive me Stallman senpai - overlays = extraOverlays ++ (lib.attrValues self.overlays); - }; - pkgs = mkPkgs nixpkgs [self.overlay]; - pkgs' = mkPkgs nixpkgs-unstable []; - - lib = - nixpkgs.lib.extend - (self: super: - { - my = import ./lib { - inherit pkgs inputs outputs; - lib = self; +outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs: + let + mkHost = hostName: system: + nixpkgs.lib.nixosSystem { + pkgs = import nixpkgs { + inherit system; + # settings to nixpkgs goes to here + # nixpkgs.pkgs.zathura.useMupdf = true; + nixpkgs.config.allowUnfree = true; }; - } - // home-manager.lib); - in { - lib = lib.my; - packages."${system}" = - mapModules ./pkgs (p: pkgs.callPackage p {}); - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; - devShell."${system}" = - import ./shell.nix {inherit pkgs;}; + specialArgs = { + # By default, the system will only use packages from the + # stable channel. You can selectively install packages + # from the unstable channel. You can also add more + # channels to pin package version. + pkgs-unstable = import nixpkgs-unstable { + inherit system; + # settings to nixpkgs-unstable goes to here + }; + + #hostName = "StuPC"; - overlay = final: prev: { - #unstable = pkgs'; - my = self.packages."${system}"; - }; + # make all inputs availabe in other nix files + inherit inputs; + }; - overlays = import ./overlays {inherit inputs;}; + modules = [ + # Root on ZFS related configuration + ./modules - # Output all modules in ./modules to flake. Modules should be in - # individual subdirectories and contain a default.nix file - nixosModules = builtins.listToAttrs (map - (x: { - name = x; - value = import (./modules/nixos + "/${x}"); - }) - (builtins.attrNames (builtins.readDir ./modules/nixos))); + # Configuration shared by all hosts - ##import our HM modules - ## -- imported in ./home-manger/general + # Configuration per host + ./hosts/${hostName} - homeManagerModules = builtins.listToAttrs (map - (name: { - inherit name; - value = import (./modules/home-manager + "/${name}"); - }) - (builtins.attrNames (builtins.readDir ./modules/home-manager))); - # nixosConfigurations = - # mapHosts ./hosts {}; - - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - go3-wsl = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs lib; - hostName = "go3-wsl"; + # home-manager + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.sstent = import ./home-manager; + } + ]; }; - modules = [ - ./hosts/go3-wsl - ]; - }; - StuPC-WSL = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs lib; - hostName = "StuPC"; - }; - modules = [ - ./hosts/StuPC-WSL - ]; + in { + nixosConfigurations = { + StuPC-WSL = mkHost "StuPC-WSL" "x86_64-linux"; }; }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - # FIXME replace with your username@hostname - "sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration { - # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - pkgs = pkgs; - extraSpecialArgs = { - inherit inputs outputs lib; - hostName = "go3-wsl"; - }; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/users/sstent - inputs.sops-nix.homeManagerModules.sops - ]; - }; - "sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration { - # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - pkgs = pkgs; - extraSpecialArgs = { - inherit inputs outputs lib; - hostName = "StuPC-WSL"; - }; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/users/sstent - inputs.sops-nix.homeManagerModules.sops - ]; - }; - }; - }; } diff --git a/home-manager/users/sstent/default.nix b/home-manager/default.nix similarity index 85% rename from home-manager/users/sstent/default.nix rename to home-manager/default.nix index 2f71397..e2ab6ea 100644 --- a/home-manager/users/sstent/default.nix +++ b/home-manager/default.nix @@ -1,25 +1,25 @@ { - inputs, - outputs, lib, - config, pkgs, + config, hostName, ... }: { - imports = [ - ../../global.nix - ]; +# imports = [ + #./global.nix + #"../modules/vscode-server/home.nix" + + # ]; home.username = "sstent"; home.homeDirectory = "/home/sstent"; home.stateVersion = "23.05"; sops = { age.sshKeyPaths = ["/home/sstent/.ssh/id_ed25519"]; - defaultSopsFile = "${config._secretstore}/user-secrets.yaml"; + defaultSopsFile = ../secrets/user-secrets.yaml; secrets = { mrconfig = { - sopsFile = "${config._secretstore}/user_dotfiles/mrconfig"; + sopsFile = ../secrets/user_dotfiles/mrconfig; format = "binary"; path = "${config.home.homeDirectory}/.mrconfig"; }; @@ -28,6 +28,25 @@ # home.file."/home/sstent/.config/beets/test".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test; + + imports = + [ + # ./beets.nix + # ./keybase.nix + ]; + # ++ (builtins.attrValues outputs.homeManagerModules); + + ###dotfiles path variable + + ##VSCode + #services.vscode-server.enable = true; + #services.vscode-server.enableFHS = true; + #services.vscode-server.nodejsPackage = pkgs.nodejs-18_x; + + #programs.git.enable = true; + + + # Let Home Manager install and manage itself. programs.home-manager.enable = true; home.packages = with pkgs; [ @@ -40,7 +59,7 @@ pyinfra sshpass nmap - nomad_1_4 + nomad consul terraform wget @@ -57,11 +76,11 @@ gnumake ]; - custom = { - ssh-proxy.enable = false; - beets.enable = true; - keybase.enable = true; - }; +# custom = { +# ssh-proxy.enable = false; +# beets.enable = true; +# keybase.enable = true; +# }; # home.file.".mrconfig".source = config.lib.file.mkOutOfStoreSymlink "${config._secrets}/mrconfig"; programs = { diff --git a/home-manager/global.nix b/home-manager/global.nix index e8e36fc..13ba09b 100644 --- a/home-manager/global.nix +++ b/home-manager/global.nix @@ -1,9 +1,9 @@ { - inputs, + #inputs, lib, pkgs, config, - outputs, + #outputs, ... }: { imports = @@ -11,8 +11,8 @@ # ./beets.nix # ./keybase.nix "${inputs.vscode-server}/modules/vscode-server/home.nix" - ] - ++ (builtins.attrValues outputs.homeManagerModules); + ]; + # ++ (builtins.attrValues outputs.homeManagerModules); ###dotfiles path variable options._dotfiles = lib.mkOption { @@ -36,21 +36,21 @@ }; config = { - nixpkgs = { - overlays = builtins.attrValues outputs.overlays; - config = { - allowUnfree = true; - allowUnfreePredicate = _: true; - }; - }; + #nixpkgs = { + # overlays = builtins.attrValues outputs.overlays; + # config = { + # allowUnfree = true; + # allowUnfreePredicate = _: true; + # }; + #}; - nix = { - package = lib.mkDefault pkgs.nix; - settings = { - experimental-features = ["nix-command" "flakes" "repl-flake"]; - warn-dirty = false; - }; - }; + #nix = { + # package = lib.mkDefault pkgs.nix; + # settings = { + # experimental-features = ["nix-command" "flakes" "repl-flake"]; + # warn-dirty = false; + # }; + #}; ##VSCode services.vscode-server.enable = true; diff --git a/home-manager/users/sstent/python-packages.nix b/home-manager/python-packages.nix similarity index 100% rename from home-manager/users/sstent/python-packages.nix rename to home-manager/python-packages.nix diff --git a/hosts/common.nix b/hosts/common.nix index d918d71..49feb93 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -1,9 +1,7 @@ -<<<<<<< HEAD # This file (and the global directory) holds config that i use on all hosts { lib, inputs, - outputs, pkgs, config, ... @@ -12,8 +10,7 @@ [ inputs.home-manager.nixosModules.home-manager inputs.sops-nix.nixosModules.sops - ] - ++ (builtins.attrValues outputs.nixosModules); + ]; ###dotfiles path variable options._dotfiles = lib.mkOption { @@ -46,7 +43,7 @@ home-manager = { useUserPackages = true; - extraSpecialArgs = {inherit inputs outputs;}; + #extraSpecialArgs = {inherit inputs outputs;}; sharedModules = [ inputs.sops-nix.homeManagerModules.sops ]; @@ -84,97 +81,3 @@ }; }; } -======= -# This file (and the global directory) holds config that i use on all hosts -{ lib, inputs, outputs, pkgs, config, ... }: -{ - imports = [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - # ./binfmt.nix - ]++ (builtins.attrValues outputs.nixosModules); - -###dotfiles path variable - options._dotfiles = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/home-manager/dotfiles"; - description = "Path to the dotfiles in this repository"; - }; - -###secrets path variable - options._secrets = lib.mkOption { - type = lib.types.str; - default = "/run/user/1000/secrets"; - description = "Path to the Secrets runtime"; - }; - - -###secretstore path variable - options._secretstore = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/secrets"; - description = "Path to the Secrets storage"; - }; - -config = { - system.stateVersion = "23.05"; - - - sops = { - defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; - age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; -}; - - - home-manager = { - useUserPackages = true; - extraSpecialArgs = { inherit inputs outputs; }; - sharedModules = [ - inputs.sops-nix.homeManagerModules.sops - ]; - }; - - nixpkgs.config.allowUnfree = true; - programs.fuse.userAllowOther = true; - security.sudo.wheelNeedsPassword = false; - - # nixpkgs.overlays = overlays; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; -nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; -# nix.extra-platforms = aarch64-linux i686-linux; - -# nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; -# boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; -boot.binfmt.emulatedSystems = ["armv7l-linux" "aarch64-linux"]; - -nix.settings.substituters = [ - "https://fbleagh.cachix.org" - "https://cache.armv7l.xyz" - "https://arm.cachix.org" - "https://thefloweringash-armv7.cachix.org" ]; -nix.settings.trusted-public-keys = [ - "fbleagh.cachix.org-1:HNgEVkx9HfKmEQdR+9IeCwqFza0k8d8fJgcYvOTVDB8=" - "cache.armv7l.xyz-1:kBY/eGnBAYiqYfg0fy0inWhshUo+pGFM3Pj7kIkmlBk=" - "arm.cachix.org-1:K3XjAeWPgWkFtSS9ge5LJSLw3xgnNqyOaG7MDecmTQ8=" - "thefloweringash-armv7.cachix.org-1:v+5yzBD2odFKeXbmC+OPWVqx4WVoIVO6UXgnSAWFtso=" -]; -nix.settings.trusted-users = [ "root" "sstent" ]; - -#services.envfs.enable = true; - environment.systemPackages = [ - pkgs.git - pkgs.home-manager - pkgs.sops - pkgs.ssh-to-age - pkgs.age - pkgs.qemu - pkgs.cachix - ]; - -}; -} ->>>>>>> dacf7df (updates) diff --git a/hosts/commonold.nix b/hosts/commonold.nix deleted file mode 100644 index 9b8b1c1..0000000 --- a/hosts/commonold.nix +++ /dev/null @@ -1,179 +0,0 @@ -<<<<<<< HEAD -# This file (and the global directory) holds config that i use on all hosts -{ - lib, - inputs, - outputs, - pkgs, - config, - ... -}: { - imports = - [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - ] - ++ (builtins.attrValues outputs.nixosModules); - - ###dotfiles path variable - options._dotfiles = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/home-manager/dotfiles"; - description = "Path to the dotfiles in this repository"; - }; - - ###secrets path variable - options._secrets = lib.mkOption { - type = lib.types.str; - default = "/run/user/1000/secrets"; - description = "Path to the Secrets runtime"; - }; - - ###secretstore path variable - options._secretstore = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/secrets"; - description = "Path to the Secrets storage"; - }; - - config = { - system.stateVersion = "23.05"; - - sops = { - defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; - age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; - }; - - home-manager = { - useUserPackages = true; - extraSpecialArgs = {inherit inputs outputs;}; - sharedModules = [ - inputs.sops-nix.homeManagerModules.sops - ]; - }; - - nixpkgs.config.allowUnfree = true; - programs.fuse.userAllowOther = true; - security.sudo.wheelNeedsPassword = false; - - # nixpkgs.overlays = overlays; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"]; - # nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; - networking.search = ["node.dc1.consul" "service.dc1.consul"]; - - #services.envfs.enable = true; - environment.systemPackages = [ - pkgs.git - pkgs.home-manager - pkgs.sops - pkgs.ssh-to-age - pkgs.age - pkgs.bitwarden-cli - ]; - - nix.gc = { - automatic = true; # Enable the automatic garbage collector - dates = "03:15"; # When to run the garbage collector - options = "-d"; # Arguments to pass to nix-collect-garbage - }; - }; -} -======= -# This file (and the global directory) holds config that i use on all hosts -{ lib, inputs, outputs, pkgs, config, ... }: -{ - imports = [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - # ./binfmt.nix - ]++ (builtins.attrValues outputs.nixosModules); - -###dotfiles path variable - options._dotfiles = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/home-manager/dotfiles"; - description = "Path to the dotfiles in this repository"; - }; - -###secrets path variable - options._secrets = lib.mkOption { - type = lib.types.str; - default = "/run/user/1000/secrets"; - description = "Path to the Secrets runtime"; - }; - - -###secretstore path variable - options._secretstore = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/secrets"; - description = "Path to the Secrets storage"; - }; - -config = { - system.stateVersion = "23.05"; - - - sops = { - defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; - age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; -}; - - - home-manager = { - useUserPackages = true; - extraSpecialArgs = { inherit inputs outputs; }; - sharedModules = [ - inputs.sops-nix.homeManagerModules.sops - ]; - }; - - nixpkgs.config.allowUnfree = true; - programs.fuse.userAllowOther = true; - security.sudo.wheelNeedsPassword = false; - - # nixpkgs.overlays = overlays; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; -nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; -# nix.extra-platforms = aarch64-linux i686-linux; - -# nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; -# boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; -boot.binfmt.emulatedSystems = ["armv7l-linux" "aarch64-linux"]; - -nix.settings.substituters = [ - "https://fbleagh.cachix.org" - "https://cache.armv7l.xyz" - "https://arm.cachix.org" - "https://thefloweringash-armv7.cachix.org" ]; -nix.settings.trusted-public-keys = [ - "fbleagh.cachix.org-1:HNgEVkx9HfKmEQdR+9IeCwqFza0k8d8fJgcYvOTVDB8=" - "cache.armv7l.xyz-1:kBY/eGnBAYiqYfg0fy0inWhshUo+pGFM3Pj7kIkmlBk=" - "arm.cachix.org-1:K3XjAeWPgWkFtSS9ge5LJSLw3xgnNqyOaG7MDecmTQ8=" - "thefloweringash-armv7.cachix.org-1:v+5yzBD2odFKeXbmC+OPWVqx4WVoIVO6UXgnSAWFtso=" -]; -nix.settings.trusted-users = [ "root" "sstent" ]; - -#services.envfs.enable = true; - environment.systemPackages = [ - pkgs.git - pkgs.home-manager - pkgs.sops - pkgs.ssh-to-age - pkgs.age - pkgs.qemu - pkgs.cachix - ]; - -}; -} ->>>>>>> dacf7df (updates) diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..c8dc875 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,44 @@ +{ system, self, nixpkgs, inputs, ... }: + +let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; # Allow proprietary software + }; + + lib = nixpkgs.lib; +in +{ + StuPC-WSL = lib.nixosSystem { + # Laptop profile + inherit system; + specialArgs = { inherit inputs; }; + modules = [ + #../home-manager #hyprland and sway,go to this dir,choose one + ] ++ [ + ./common.nix + ] ++ [ + inputs.home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + # extraSpecialArgs = { inherit user; }; + users.sstent = { + imports = [ + (import ../home-manager) + ] ++ [ + ]; + }; + }; + nixpkgs = { + overlays = + [ + self.overlays.default + ]; + }; + } + ]; + }; + +} \ No newline at end of file diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..d372a5b --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: { imports = [ + + +./nixos/mnt_public +./nixos/ssh +./nixos/syncthing +./nixos/vpn +./nixos/wsl2 + +]; } diff --git a/pkgs/default.nix b/pkgs/default.nix index fd49ac3..2c9150f 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,12 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' -{pkgs ? (import ../nixpkgs.nix) {}}: { - # example = pkgs.callPackage ./example { }; - npiperelay = pkgs.callPackage ./npiperelay {}; -} +rec{ + overlay = final: prev: + let + dirContents = builtins.readDir ../pkgs; + genPackage = name: { + inherit name; + value = final.callPackage (../pkgs + "/${name}") { }; + }; + names = builtins.attrNames dirContents; + in + builtins.listToAttrs (map genPackage names); +} \ No newline at end of file