From c3b3c4101ea9bfeb3b9223ab251f251dab7f9189 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 3 May 2023 12:23:45 +0300 Subject: [PATCH] Various fixes, idk --- .gitignore | 1 + flake.lock | 48 +++++++++++++++++++ flake.nix | 36 +++++++------- link.sh | 2 +- machines/asus/{user-name.nix => username.nix} | 0 5 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 flake.lock mode change 100644 => 100755 link.sh rename machines/asus/{user-name.nix => username.nix} (100%) diff --git a/.gitignore b/.gitignore index 08a8397..3613b5a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ !machines/asus/system/ !machines/asus/xserver/ +!flake.lock !.editorconfig !.gitignore diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..43aa145 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682977601, + "narHash": "sha256-F1Va/Uiw2tVNn27FLqWyBkiqDyIm/eCamw9wA/GK8Fw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0e4c33d76006c9080d2f228ba1c2308e3e4d7be6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1683014792, + "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 5aa13cb..fdf02de 100644 --- a/flake.nix +++ b/flake.nix @@ -34,28 +34,28 @@ let lib = nixpkgs.lib; - importConfiguration = directory: lib.nixosSystem { - specialArgs = { - inherit lib; # plasma-manager; + importConfiguration = directory: { + nixosConfigurations.${builtins.baseNameOf directory} = lib.nixosSystem { + specialArgs = { + inherit lib; # plasma-manager; - pkgs = import nixpkgs { - config.allowUnfree = true; + pkgs = import nixpkgs { + config.allowUnfree = true; + }; + + homeManagerConfiguration = attrs: + let + userName = import (directory + "username.nix"); + in + { + home-manager.users.${userName} = attrs; + }; }; - homeManagerConfiguration = attrs: - let - userName = import (directory + "user-name.nix"); - in - { - home-manager.users.${userName} = attrs; - }; - }; - - nixosConfigurations.${basename directory} = { modules = [ directory { - networking.hostName = basename directory; + networking.hostName = builtins.baseNameOf directory; } home-manager.nixosModules.home-manager @@ -67,5 +67,7 @@ }; }; in - builtins.foldl lib.recursiveUpdate (builtins.map importConfiguration (builtins.readDir ./machines)); + builtins.foldl' lib.recursiveUpdate {} (builtins.map importConfiguration [ + ./machines/asus # HACK: Use a function to list the directory. + ]); } diff --git a/link.sh b/link.sh old mode 100644 new mode 100755 index fcb28e8..94ef948 --- a/link.sh +++ b/link.sh @@ -8,7 +8,7 @@ sudo mkdir /etc/nixos echo "* Linking files" sudo ln ./flake.nix /etc/nixos/flake.nix -sudo ln ./flake.lock /etc/nixos/flake.nix +sudo ln ./flake.lock /etc/nixos/flake.lock sudo ln -s ./system-configuration /etc/nixos/ sudo ln -s ./home-configuration /etc/nixos/ diff --git a/machines/asus/user-name.nix b/machines/asus/username.nix similarity index 100% rename from machines/asus/user-name.nix rename to machines/asus/username.nix