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

View file

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

View file

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

View file

@ -2,16 +2,8 @@
config,
pkgs,
lib,
cyplo,
...
}:
let
username =
if cyplo ? username
then "${cyplo.username}"
else "cyryl";
in
{
}: {
nix.settings = {
trusted-substituters = [
"https://helix.cachix.org"
@ -20,5 +12,5 @@ in
"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,
pkgs,
lib,
cyplo,
...
}: let
username =
if cyplo ? username
then "${cyplo.username}"
else "cyryl";
in {
}: {
programs.zsh.enable = true;
home-manager.users."${username}" = {...}: {imports = [./home.nix];};
home-manager.users."${config.local.username}" = {...}: {imports = [./home.nix];};
}