migrate to using module options for the username
Some checks failed
use nix / build (push) Failing after 6m0s

This commit is contained in:
Cyryl Płotnicki 2024-10-02 21:35:56 +01:00
parent 9086c5f3a6
commit 3ead6500a8
6 changed files with 24 additions and 47 deletions

View file

@ -106,6 +106,7 @@
inherit system; inherit system;
modules = [ modules = [
lix-module.nixosModules.default lix-module.nixosModules.default
(import ./nixos/options.nix)
(./. + "/nixos/boxes/${hostname}") (./. + "/nixos/boxes/${hostname}")
(import ./nixos/email-accounts.nix) (import ./nixos/email-accounts.nix)
(import ./nixos/common.nix) (import ./nixos/common.nix)
@ -171,6 +172,7 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
modules = [ modules = [
lix-module.nixosModules.default lix-module.nixosModules.default
(import ./nixos/options.nix)
(./. + "/nixos/boxes/cushy") (./. + "/nixos/boxes/cushy")
{users.users."Cyryl.Plotnicki".home = "/Users/Cyryl.Plotnicki";} {users.users."Cyryl.Plotnicki".home = "/Users/Cyryl.Plotnicki";}
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
@ -196,6 +198,7 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
modules = [ modules = [
lix-module.nixosModules.default lix-module.nixosModules.default
(import ./nixos/options.nix)
(./. + "/nixos/boxes/airy") (./. + "/nixos/boxes/airy")
{users.users.cyryl.home = "/Users/cyryl";} {users.users.cyryl.home = "/Users/cyryl";}
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager

View file

@ -5,28 +5,12 @@
lib, lib,
nixpkgs-nixos-unstable-and-unfree, nixpkgs-nixos-unstable-and-unfree,
... ...
}: let }: {
username = "Cyryl.Plotnicki"; local.username = "Cyryl.Plotnicki";
in {
imports = [ imports = [
(import ../../zsh { ../../zsh
inherit pkgs; ../../git
inherit lib; ../../helix
inherit config;
cyplo.username = username;
})
(import ../../git {
inherit pkgs;
inherit lib;
inherit config;
cyplo.username = username;
})
(import ../../helix {
inherit pkgs;
inherit lib;
inherit config;
cyplo.username = username;
})
]; ];
services.nix-daemon.enable = true; services.nix-daemon.enable = true;

View file

@ -2,13 +2,7 @@
config, config,
pkgs, pkgs,
lib, lib,
cyplo,
... ...
}: let }: {
username = home-manager.users."${config.local.username}" = {...}: {imports = [./home.nix];};
if cyplo ? username
then "${cyplo.username}"
else "cyryl";
in {
home-manager.users."${username}" = {...}: {imports = [./home.nix];};
} }

View file

@ -2,16 +2,8 @@
config, config,
pkgs, pkgs,
lib, lib,
cyplo,
... ...
}: }: {
let
username =
if cyplo ? username
then "${cyplo.username}"
else "cyryl";
in
{
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [
"https://helix.cachix.org" "https://helix.cachix.org"
@ -20,5 +12,5 @@ in
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
]; ];
}; };
home-manager.users."${username}" = {...}: {imports = [./home.nix];}; home-manager.users."${config.local.username}" = {...}: {imports = [./home.nix];};
} }

10
nixos/options.nix Normal file
View file

@ -0,0 +1,10 @@
{
lib,
pkgs,
...
}: {
options.local.username = lib.mkOption {
default = "cyryl";
type = lib.types.str;
};
}

View file

@ -2,14 +2,8 @@
config, config,
pkgs, pkgs,
lib, lib,
cyplo,
... ...
}: let }: {
username =
if cyplo ? username
then "${cyplo.username}"
else "cyryl";
in {
programs.zsh.enable = true; programs.zsh.enable = true;
home-manager.users."${username}" = {...}: {imports = [./home.nix];}; home-manager.users."${config.local.username}" = {...}: {imports = [./home.nix];};
} }