small cleanup; blender->blender-hip; linux-zen->linux_latest
the latter one is for system76-scheduler compatibility since they broke stuff for zen kernel users
This commit is contained in:
parent
b60e204f1e
commit
ebc7241725
54
flake.nix
54
flake.nix
|
@ -40,19 +40,18 @@
|
||||||
# yes, this is impure, this is a last ditch effort at getting access to secrets
|
# yes, this is impure, this is a last ditch effort at getting access to secrets
|
||||||
else import /etc/nixos/private { };
|
else import /etc/nixos/private { };
|
||||||
# if x has key s, get it. Otherwise return def
|
# if x has key s, get it. Otherwise return def
|
||||||
getOr = def: s: x: with builtins; if hasAttr s x then getAttr s x else def;
|
|
||||||
# All private config for hostname
|
# All private config for hostname
|
||||||
getPriv = hostname: getOr { } hostname priv;
|
getPriv = hostname: priv.${hostname} or { };
|
||||||
# Private NixOS config for hostname
|
# Private NixOS config for hostname
|
||||||
getPrivSys = hostname: getOr { } "system" (getPriv hostname);
|
getPrivSys = hostname: (getPriv hostname).system or { };
|
||||||
# Private home-manager config for hostname and username
|
# Private home-manager config for hostname and username
|
||||||
getPrivUser = hostname: user: getOr { } user (getPriv hostname);
|
getPrivUser = hostname: user: (getPriv hostname).${user} or { };
|
||||||
# extended lib
|
# extended lib
|
||||||
lib = nixpkgs.lib // {
|
lib = nixpkgs.lib // {
|
||||||
quoteListenAddr = addr:
|
quoteListenAddr = addr:
|
||||||
if nixpkgs.lib.hasInfix ":" addr then "[${addr}]" else addr;
|
if nixpkgs.lib.hasInfix ":" addr then "[${addr}]" else addr;
|
||||||
};
|
};
|
||||||
# can't use callPackage here, idk why; use import instead
|
# can't use callPackage ./pkgs here, idk why; use import instead
|
||||||
overlay = self: super: import ./pkgs {
|
overlay = self: super: import ./pkgs {
|
||||||
pkgs = super;
|
pkgs = super;
|
||||||
lib = super.lib;
|
lib = super.lib;
|
||||||
|
@ -109,26 +108,37 @@
|
||||||
nixosConfigurations = builtins.mapAttrs (hostname: args @ { system ? "x86_64-linux", modules, nixpkgs ? {}, home ? {}, ... }:
|
nixosConfigurations = builtins.mapAttrs (hostname: args @ { system ? "x86_64-linux", modules, nixpkgs ? {}, home ? {}, ... }:
|
||||||
lib.nixosSystem ({
|
lib.nixosSystem ({
|
||||||
inherit system;
|
inherit system;
|
||||||
|
# allow modules to access nixpkgs directly, use customized lib,
|
||||||
|
# and pass nixos-harware to let hardware modules import parts of nixos-hardware
|
||||||
|
specialArgs = {
|
||||||
|
inherit lib nixpkgs;
|
||||||
|
hardware = nixos-hardware.nixosModules;
|
||||||
|
};
|
||||||
modules = modules ++ [
|
modules = modules ++ [
|
||||||
{ networking.hostName = hostname; }
|
# Third-party NixOS modules
|
||||||
|
impermanence.nixosModule
|
||||||
|
# My custom NixOS modules
|
||||||
./system/modules/vfio.nix
|
./system/modules/vfio.nix
|
||||||
./system/modules/ccache.nix
|
./system/modules/ccache.nix
|
||||||
./system/modules/impermanence.nix
|
./system/modules/impermanence.nix
|
||||||
./system/modules/common.nix
|
./system/modules/common.nix
|
||||||
impermanence.nixosModule
|
|
||||||
(getPrivSys hostname)
|
(getPrivSys hostname)
|
||||||
|
# The common configuration that isn't part of common.nix
|
||||||
({ config, pkgs, ... }: {
|
({ config, pkgs, ... }: {
|
||||||
|
networking.hostName = hostname;
|
||||||
nixpkgs.overlays = [ overlay ];
|
nixpkgs.overlays = [ overlay ];
|
||||||
nix.extraOptions = ''
|
nix.extraOptions = ''
|
||||||
plugin-files = ${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so
|
plugin-files = ${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# registry is used for the new flaky nix command
|
||||||
nix.registry =
|
nix.registry =
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(_: v: { flake = v; })
|
(_: v: { flake = v; })
|
||||||
(lib.filterAttrs (_: v: v?outputs) inputs);
|
(lib.filterAttrs (_: v: v?outputs) inputs);
|
||||||
|
|
||||||
# add import'able flakes (like nixpkgs) to nix path
|
# add import'able flake inputs (like nixpkgs) to nix path
|
||||||
|
# nix path is used for old nix commands (like nix-build, nix-shell)
|
||||||
environment.etc = lib.mapAttrs'
|
environment.etc = lib.mapAttrs'
|
||||||
(name: value: {
|
(name: value: {
|
||||||
name = "nix/inputs/${name}";
|
name = "nix/inputs/${name}";
|
||||||
|
@ -137,21 +147,22 @@
|
||||||
(lib.filterAttrs (_: v: builtins.pathExists "${v}/default.nix") inputs);
|
(lib.filterAttrs (_: v: builtins.pathExists "${v}/default.nix") inputs);
|
||||||
nix.nixPath = [ "/etc/nix/inputs" ];
|
nix.nixPath = [ "/etc/nix/inputs" ];
|
||||||
})
|
})
|
||||||
] ++ (lib.optionals (home != {} && (getOr true "enableNixosModule" (getOr {} "common" home))) [
|
]
|
||||||
# only use NixOS HM module if same nixpkgs as system nixpkgs is used for user
|
# the following is NixOS home-manager module configuration. Currently unused, but I might start using it for some hosts later.
|
||||||
# why? because it seems that HM lacks the option to override pkgs, only change nixpkgs.* settings
|
++ (lib.optionals (home != {} && ((home.common or {}).enableNixosModule or true)) [
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager = builtins.removeAttrs (getOr { } "common" home) [ "nixpkgs" "nix" "enableNixosModule" ];
|
home-manager = builtins.removeAttrs (home.common or { }) [ "nixpkgs" "nix" "enableNixosModule" ];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
# set both to false to match behavior with standalone home-manager
|
||||||
home-manager.useGlobalPkgs = false;
|
home-manager.useGlobalPkgs = false;
|
||||||
home-manager.useUserPackages = false;
|
home-manager.useUserPackages = false;
|
||||||
home-manager.users = builtins.mapAttrs (username: modules: {
|
home-manager.users = builtins.mapAttrs (username: modules: {
|
||||||
imports = modules ++ [
|
imports = modules ++ [
|
||||||
{
|
{
|
||||||
nixpkgs = getOr { } "nixpkgs" (getOr { } "common" home);
|
nixpkgs = (home.common or { }).nixpkgs or { };
|
||||||
nix = getOr { } "nix" (getOr { } "common" home);
|
nix = (home.common or { }).nix or { };
|
||||||
}
|
}
|
||||||
({ config, pkgs, lib, ...}: {
|
({ config, pkgs, lib, ...}: {
|
||||||
nixpkgs.overlays = [ overlay ];
|
nixpkgs.overlays = [ overlay ];
|
||||||
|
@ -165,12 +176,9 @@
|
||||||
}) (builtins.removeAttrs home [ "common" ]);
|
}) (builtins.removeAttrs home [ "common" ]);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
specialArgs = {
|
|
||||||
inherit lib nixpkgs;
|
|
||||||
hardware = nixos-hardware.nixosModules;
|
|
||||||
};
|
|
||||||
} // (builtins.removeAttrs args [ "home" "modules" "nixpkgs" ])))
|
} // (builtins.removeAttrs args [ "home" "modules" "nixpkgs" ])))
|
||||||
config;
|
config;
|
||||||
|
|
||||||
# for each hostname, for each user, generate an attribute "${user}@${hostname}"
|
# for each hostname, for each user, generate an attribute "${user}@${hostname}"
|
||||||
homeConfigurations =
|
homeConfigurations =
|
||||||
builtins.foldl'
|
builtins.foldl'
|
||||||
|
@ -181,14 +189,14 @@
|
||||||
(hostname: sysConfig:
|
(hostname: sysConfig:
|
||||||
let
|
let
|
||||||
system = if sysConfig?system then sysConfig.system else "x86_64-linux";
|
system = if sysConfig?system then sysConfig.system else "x86_64-linux";
|
||||||
common = builtins.removeAttrs (getOr { } "common" sysConfig.home) [ "nixpkgs" "enableNixosModule" ];
|
common' = builtins.removeAttrs (sysConfig.home.common or { }) [ "nix" "nixpkgs" "enableNixosModule" ];
|
||||||
pkgs = getOr (mkPkgs { inherit system; }) "pkgs" common;
|
pkgs = mkPkgs ({ inherit system; } // ((sysConfig.home.common or { }).nixpkgs or {}));
|
||||||
common' = common // { inherit pkgs; };
|
common = common' // { inherit pkgs; };
|
||||||
in
|
in
|
||||||
lib.mapAttrsToList
|
lib.mapAttrsToList
|
||||||
# this is where actual config takes place
|
# this is where actual config takes place
|
||||||
(user: homeConfig: {
|
(user: homeConfig: {
|
||||||
"${user}@${hostname}" = home-manager.lib.homeManagerConfiguration (common' // {
|
"${user}@${hostname}" = home-manager.lib.homeManagerConfiguration (common // {
|
||||||
modules = homeConfig ++ [
|
modules = homeConfig ++ [
|
||||||
(getPrivUser hostname user)
|
(getPrivUser hostname user)
|
||||||
({ config, pkgs, lib, ... }: {
|
({ config, pkgs, lib, ... }: {
|
||||||
|
@ -201,7 +209,7 @@
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
(builtins.removeAttrs (getOr { } "home" sysConfig) [ "common" ]))
|
(builtins.removeAttrs (sysConfig.home or { }) [ "common" ]))
|
||||||
config));
|
config));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
protontricks # proton-caller
|
protontricks # proton-caller
|
||||||
# bottles
|
# bottles
|
||||||
virtmanager
|
virtmanager
|
||||||
gimp krita blender
|
gimp krita blender-hip
|
||||||
tdesktop
|
tdesktop
|
||||||
clang_latest rustc rustfmt cargo clippy
|
clang_latest rustc rustfmt cargo clippy
|
||||||
kdenlive
|
kdenlive
|
||||||
|
|
|
@ -40,7 +40,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
rofi-steam-game-list = callPackage ./rofi-steam-game-list { };
|
rofi-steam-game-list = callPackage ./rofi-steam-game-list { };
|
||||||
system76-scheduler = callPackage ./system76-scheduler.nix { };
|
# system76-scheduler = callPackage ./system76-scheduler.nix { };
|
||||||
techmino = callPackage ./techmino { };
|
techmino = callPackage ./techmino { };
|
||||||
|
|
||||||
firefox-addons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; });
|
firefox-addons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; });
|
||||||
|
|
|
@ -84,7 +84,7 @@ in {
|
||||||
"vm.dirty_background_ratio" = 2;
|
"vm.dirty_background_ratio" = 2;
|
||||||
"vm.swappiness" = 40;
|
"vm.swappiness" = 40;
|
||||||
};
|
};
|
||||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_zen;
|
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||||
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
|
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ in {
|
||||||
services.mullvad-vpn.package = pkgs.mullvad-vpn;
|
services.mullvad-vpn.package = pkgs.mullvad-vpn;
|
||||||
|
|
||||||
# System76 scheduler (not actually a scheduler, just a renice daemon) for improved responsiveness
|
# System76 scheduler (not actually a scheduler, just a renice daemon) for improved responsiveness
|
||||||
services.dbus.packages = [ pkgs.system76-scheduler ];
|
/*services.dbus.packages = [ pkgs.system76-scheduler ];
|
||||||
systemd.services."system76-scheduler" = {
|
systemd.services."system76-scheduler" = {
|
||||||
description = "Automatically configure CPU scheduler for responsiveness on AC";
|
description = "Automatically configure CPU scheduler for responsiveness on AC";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
@ -211,7 +211,8 @@ in {
|
||||||
environment.etc."system76-scheduler/config.ron".source =
|
environment.etc."system76-scheduler/config.ron".source =
|
||||||
"${pkgs.system76-scheduler}/etc/system76-scheduler/config.ron";
|
"${pkgs.system76-scheduler}/etc/system76-scheduler/config.ron";
|
||||||
environment.etc."system76-scheduler/exceptions.ron".source =
|
environment.etc."system76-scheduler/exceptions.ron".source =
|
||||||
"${pkgs.system76-scheduler}/etc/system76-scheduler/exceptions.ron";
|
"${pkgs.system76-scheduler}/etc/system76-scheduler/exceptions.ron";*/
|
||||||
|
services.system76-scheduler.enable = true;
|
||||||
|
|
||||||
common.workstation = true;
|
common.workstation = true;
|
||||||
common.gettyAutologin = true;
|
common.gettyAutologin = true;
|
||||||
|
|
Loading…
Reference in a new issue