Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitfe8588af061dcd0f00d83d660a4006c8fea8fa5c (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-11-28 20:10:35 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-11-28 20:10:35 +0200
Files29f44ff43987c4f124ae7606dade4fc71e7517f2
nix-fe8588af061dcd0f00d83d660a4006c8fea8fa5c.tar
nix-fe8588af061dcd0f00d83d660a4006c8fea8fa5c.tar.gz
nix-fe8588af061dcd0f00d83d660a4006c8fea8fa5c.zip
Parentdbd413e482d6ec53836232ae89bb57f808609635 (diff)
(autoconfig) Initial setup for packages
4 files changed, 76 insertions, 18 deletions
-rw-r--r--autoconfig.nix51
-rw-r--r--flake.nix3
-rw-r--r--packages.nix14
-rw-r--r--packages/default.nix26
diff --git a/autoconfig.nix b/autoconfig.nix
index 5460362..74424f1 100644
--- a/autoconfig.nix
+++ b/autoconfig.nix
@@ -1,7 +1,22 @@
-{ inputs, ... }:
+{ self, inputs, ... }:
let
inherit (inputs) nixpkgs;
inherit (nixpkgs) lib;
+ _mergeAttrs =
+ let
+ recurse = attrset:
+ lib.zipAttrsWith
+ (name: values:
+ if builtins.isAttrs (builtins.head values) then
+ recurse (builtins.filter (val: builtins.isAttrs val) values)
+ else if builtins.isList (builtins.head values) then
+ lib.concatLists (builtins.filter (val: builtins.isList val) values)
+ else
+ lib.last values
+ )
+ attrset;
+ in
+ recurse;
in {
configurations =
lib.mapAttrs
@@ -13,8 +28,38 @@ in {
modules = [
./machines/${dir}/hardware-configuration.nix
./configuration.nix
+ self.packages
];
- }
- )
+ })
(lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./machines));
+
+ packages =
+ let
+ package-groups = import ./packages/default.nix { inherit nixpkgs; };
+ in
+ lib.foldlAttrs
+ (config: _: package-group:
+ let
+ config-from-group =
+ lib.foldlAttrs
+ (acc: pkg-name: pkg-settings:
+ if pkg-name == "list" then
+ _mergeAttrs [
+ acc
+ {
+ environment.systemPackages = pkg-settings;
+ }]
+ else
+ _mergeAttrs [
+ acc
+ (lib.filterAttrs (name: _: name != "ref") pkg-settings)
+ {
+ environment.systemPackages = [pkg-settings.ref];
+ }])
+ {}
+ package-group;
+ in
+ _mergeAttrs [config config-from-group])
+ {}
+ package-groups; # TODO: filter on machine type
}
diff --git a/flake.nix b/flake.nix
index 3726b18..daccdc7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,9 +7,8 @@
outputs = { self, nixpkgs, ... }@inputs:
let
- autoconfig = import ./autoconfig.nix { inherit inputs; };
+ autoconfig = import ./autoconfig.nix { self = autoconfig; inherit inputs; };
in {
- # ThinkPad X270
nixosConfigurations = autoconfig.configurations;
};
}
diff --git a/packages.nix b/packages.nix
index 1889071..ecc6209 100644
--- a/packages.nix
+++ b/packages.nix
@@ -14,17 +14,6 @@ in {
# $ nix search wget
environment.systemPackages = with pkgs;
let
- cli-core = [
- # Hardware managing apps
- pipewire libinput lm_sensors lshw usbutils chrony iotop bluez
- parted dosfstools mtpfs ntfs3g squashfsTools
- # Network
- wget git rsync inetutils vnstat
- # Working with files
- vim-full inotify-tools lsof tree
- # General usage
- zsh htop rlwrap bc ddrescue cron
- ];
cli-userspace = [
# Working with files
ffmpeg img2pdf pdftk imagemagick pngcrush jpegoptim optipng gd kid3 pandoc libisoburn
@@ -92,7 +81,7 @@ in {
lowdown wakatime cloc go php fontforge
];
- in cli-core ++ cli-userspace ++ openboxDE-userspace ++ openboxDE-core ++ dev ++
+ in cli-userspace ++ openboxDE-userspace ++ openboxDE-core ++ dev ++
(if sysidentity.type == "laptop" then laptop else desktop) ++
(if sysidentity.name == "juno" then juno else []);
@@ -106,7 +95,6 @@ in {
# List services that you want to enable:
programs = {
dconf.enable = true;
- zsh.enable = true;
gnome-disks.enable = true;
firefox.enable = true;
diff --git a/packages/default.nix b/packages/default.nix
new file mode 100644
index 0000000..4d58753
--- /dev/null
+++ b/packages/default.nix
@@ -0,0 +1,26 @@
+{ pkgs, ... }: {
+ cli-core = {
+ list = with pkgs; [
+ # Hardware managing apps
+ pipewire libinput lm_sensors lshw usbutils chrony iotop bluez
+ parted dosfstools mtpfs ntfs3g squashfsTools
+ # Network
+ wget git rsync inetutils vnstat
+ # Working with files
+ vim-full inotify-tools lsof tree
+ # General usage
+ htop rlwrap bc ddrescue cron
+ ];
+
+ zsh = {
+ ref = pkgs.zsh;
+ programs.zsh.enable = true;
+ environment.shells = with pkgs; [ zsh ];
+ };
+
+ bluez = {
+ ref = pkgs.bluez;
+ hardware.bluetooth.enable = true;
+ };
+ };
+}