Refactor
This commit is contained in:
parent
0152e1a95f
commit
a1ab0811bb
18
default.nix
18
default.nix
|
@ -2,11 +2,10 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
with lib.my;
|
with lib.my;
|
||||||
with inputs;
|
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
# I use home-manager to deploy files to $HOME; little else
|
# I use home-manager to deploy files to $HOME; little else
|
||||||
[ home-manager.nixosModules.home-manager ]
|
[ inputs.home-manager.nixosModules.home-manager ]
|
||||||
# All my personal modules
|
# All my personal modules
|
||||||
++ (mapModulesRec' (toString ./modules) import);
|
++ (mapModulesRec' (toString ./modules) import);
|
||||||
|
|
||||||
|
@ -16,10 +15,14 @@ with inputs;
|
||||||
|
|
||||||
# Configure nix and nixpkgs
|
# Configure nix and nixpkgs
|
||||||
environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
|
environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
|
||||||
nix = {
|
nix =
|
||||||
|
let filteredInputs = filterAttrs (n: _: n != "self") inputs;
|
||||||
|
nixPathInputs = mapAttrsToList (n: v: "${n}=${v}") filteredInputs;
|
||||||
|
registryInputs = mapAttrs (_: v: { flake = v; }) filteredInputs;
|
||||||
|
in {
|
||||||
package = pkgs.nixFlakes;
|
package = pkgs.nixFlakes;
|
||||||
extraOptions = "experimental-features = nix-command flakes";
|
extraOptions = "experimental-features = nix-command flakes";
|
||||||
nixPath = (mapAttrsToList (n: v: "${n}=${v}") inputs) ++ [
|
nixPath = nixPathInputs ++ [
|
||||||
"nixpkgs-overlays=${dotFilesDir}/overlays"
|
"nixpkgs-overlays=${dotFilesDir}/overlays"
|
||||||
"dotfiles=${dotFilesDir}"
|
"dotfiles=${dotFilesDir}"
|
||||||
];
|
];
|
||||||
|
@ -29,13 +32,10 @@ with inputs;
|
||||||
binaryCachePublicKeys = [
|
binaryCachePublicKeys = [
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
];
|
];
|
||||||
registry = {
|
registry = registryInputs // { dotfiles.flake = inputs.self; };
|
||||||
nixos.flake = nixpkgs;
|
|
||||||
nixpkgs.flake = nixpkgs-unstable;
|
|
||||||
};
|
|
||||||
useSandbox = true;
|
useSandbox = true;
|
||||||
};
|
};
|
||||||
system.configurationRevision = mkIf (self ? rev) self.rev;
|
system.configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||||
system.stateVersion = "20.09";
|
system.stateVersion = "20.09";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
{ dotfiles = import ./.; } // mapModulesRec ./modules import;
|
{ dotfiles = import ./.; } // mapModulesRec ./modules import;
|
||||||
|
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
mapHosts ./hosts { inherit system; };
|
mapHosts ./hosts {};
|
||||||
|
|
||||||
devShell."${system}" =
|
devShell."${system}" =
|
||||||
import ./shell.nix { inherit pkgs; };
|
import ./shell.nix { inherit pkgs; };
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
with lib.my;
|
with lib.my;
|
||||||
let system = "x86_64-linux";
|
let sys = "x86_64-linux";
|
||||||
in {
|
in {
|
||||||
mkHost = path: attrs @ { system ? system, ... }:
|
mkHost = path: attrs @ { system ? sys, ... }:
|
||||||
nixosSystem {
|
nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit lib inputs; };
|
specialArgs = { inherit lib inputs system; };
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
nixpkgs.pkgs = pkgs;
|
nixpkgs.pkgs = pkgs;
|
||||||
|
|
|
@ -9,7 +9,4 @@ rec {
|
||||||
configDir = "${dotFilesDir}/config";
|
configDir = "${dotFilesDir}/config";
|
||||||
binDir = "${dotFilesDir}/bin";
|
binDir = "${dotFilesDir}/bin";
|
||||||
themesDir = "${modulesDir}/themes";
|
themesDir = "${modulesDir}/themes";
|
||||||
homeDir = "/home/${let name = getEnv "USERNAME"; in
|
|
||||||
if elem name [ "" "root" ]
|
|
||||||
then "hlissner" else name}";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ in {
|
||||||
# Enable userContent.css and userChrome.css for our theme modules
|
# Enable userContent.css and userChrome.css for our theme modules
|
||||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||||
# Stop creating ~/Downloads!
|
# Stop creating ~/Downloads!
|
||||||
"browser.download.dir" = "${homeDir}/dl";
|
"browser.download.dir" = "${config.user.home}/dl";
|
||||||
# Don't use the built-in password manager; a nixos user is more likely
|
# Don't use the built-in password manager; a nixos user is more likely
|
||||||
# using an external one (you are using one, right?).
|
# using an external one (you are using one, right?).
|
||||||
"signon.rememberSignons" = false;
|
"signon.rememberSignons" = false;
|
||||||
|
|
|
@ -113,7 +113,7 @@ in {
|
||||||
|
|
||||||
# Clean up leftovers, as much as we can
|
# Clean up leftovers, as much as we can
|
||||||
system.userActivationScripts.cleanupHome = ''
|
system.userActivationScripts.cleanupHome = ''
|
||||||
pushd "${homeDir}"
|
pushd "${config.user.home}"
|
||||||
rm -rf .compose-cache .nv .pki .dbus .fehbg
|
rm -rf .compose-cache .nv .pki .dbus .fehbg
|
||||||
[ -s .xsession-errors ] || rm -f .xsession-errors*
|
[ -s .xsession-errors ] || rm -f .xsession-errors*
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -24,13 +24,15 @@ with lib.my;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
user = {
|
user =
|
||||||
|
let user = builtins.getEnv "USER";
|
||||||
|
name = if elem user [ "" "root" ] then "hlissner" else user;
|
||||||
|
in {
|
||||||
|
inherit name;
|
||||||
description = "The primary user account";
|
description = "The primary user account";
|
||||||
extraGroups = [ "wheel" ];
|
extraGroups = [ "wheel" ];
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
name = let name = builtins.getEnv "USER"; in
|
home = "/home/${name}";
|
||||||
if elem name [ "" "root" ]
|
|
||||||
then "hlissner" else name;
|
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.transmission = {
|
services.transmission = {
|
||||||
enable = true;
|
enable = true;
|
||||||
home = "${homeDir}/torrents";
|
home = "${config.user.home}/torrents";
|
||||||
settings = {
|
settings = {
|
||||||
incomplete-dir-enabled = true;
|
incomplete-dir-enabled = true;
|
||||||
rpc-whitelist = "127.0.0.1,192.168.*.*";
|
rpc-whitelist = "127.0.0.1,192.168.*.*";
|
||||||
|
|
Loading…
Reference in a new issue