Parameterize username

This commit is contained in:
Henrik Lissner 2020-04-06 23:06:47 -04:00
parent d56556b26f
commit 4bc88b4548
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 12 additions and 30 deletions

View file

@ -53,7 +53,7 @@ channels:
$(NIXOS_PREFIX)/configuration.nix: $(NIXOS_PREFIX)/configuration.nix:
@sudo nixos-generate-config --root "$(PREFIX)" @sudo nixos-generate-config --root "$(PREFIX)"
@echo "import /etc/dotfiles \"$$(hostname)\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix" @echo "import /etc/dotfiles \"$${HOST:-$$(hostname)}\" \"$$USER\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
# Convenience aliases # Convenience aliases

View file

@ -50,7 +50,7 @@ nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
# make /etc/nixos/configuration.nix # make /etc/nixos/configuration.nix
nixos-generate-config --root /mnt nixos-generate-config --root /mnt
echo "import /etc/dotfiles \"$$(hostname)\"" >/mnt/etc/nixos/configuration.nix echo "import /etc/dotfiles \"$$HOST\" \"$$USER\"" >/mnt/etc/nixos/configuration.nix
# make install # make install
nixos-install --root /mnt -I "my=/etc/dotfiles" nixos-install --root /mnt -I "my=/etc/dotfiles"

View file

@ -1,6 +1,6 @@
# default.nix --- my dotfile bootstrapper # default.nix --- my dotfile bootstrapper
device: device: username:
{ pkgs, options, lib, config, ... }: { pkgs, options, lib, config, ... }:
{ {
networking.hostName = lib.mkDefault device; networking.hostName = lib.mkDefault device;
@ -33,6 +33,15 @@ device:
dots = "make -C ~/.dotfiles"; dots = "make -C ~/.dotfiles";
}; };
### Primary user account
my.username = username;
my.user = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "video" "networkmanager" ];
shell = pkgs.zsh;
};
# This value determines the NixOS release with which your system is to be # This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database # compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you # servers. You should change this only after NixOS release notes say you

View file

@ -1,24 +0,0 @@
# hosts/common.nix --- settings common to all my systems
{ pkgs, ... }:
{
# Just the bear necessities~
environment.systemPackages = with pkgs; [
coreutils
git
killall
unzip
vim
wget
sshfs
];
### My user settings
my.username = "hlissner";
my.user = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "video" "networkmanager" ];
shell = pkgs.zsh;
};
}

View file

@ -33,7 +33,6 @@
with pkgs; [ inetutils mtr sysstat git ]; with pkgs; [ inetutils mtr sysstat git ];
imports = [ imports = [
./common.nix
<modules/editors/vim.nix> <modules/editors/vim.nix>
<modules/shell/git.nix> <modules/shell/git.nix>
<modules/shell/zsh.nix> <modules/shell/zsh.nix>

View file

@ -2,8 +2,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ./common.nix ];
# Support for more filesystems # Support for more filesystems
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
exfat exfat