porthos: split into modules
I have separated the modules into host-specific settings, and generic settings that ought to be shared by every host. I only have the 'porthos' host for now, but intend to also add my laptop 'aramis' at some point to this repository.
This commit is contained in:
parent
d1d33fd1d1
commit
3b148ad684
14 changed files with 224 additions and 178 deletions
11
modules/default.nix
Normal file
11
modules/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Common modules
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./language.nix
|
||||
./nix.nix
|
||||
./packages.nix
|
||||
./users.nix
|
||||
];
|
||||
}
|
||||
7
modules/language.nix
Normal file
7
modules/language.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Language settings
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
}
|
||||
11
modules/nix.nix
Normal file
11
modules/nix.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Nix related settings
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
nix = {
|
||||
package = pkgs.nixFlakes;
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
};
|
||||
}
|
||||
16
modules/packages.nix
Normal file
16
modules/packages.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Common packages
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
git-crypt
|
||||
mosh
|
||||
vim
|
||||
wget
|
||||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true; # Because I don't care *that* much.
|
||||
}
|
||||
25
modules/users.nix
Normal file
25
modules/users.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# User setup
|
||||
{ config, ... }:
|
||||
let
|
||||
my = config.my;
|
||||
in
|
||||
{
|
||||
users.mutableUsers = false; # I want it to be declarative.
|
||||
|
||||
# Define user accounts and passwords.
|
||||
users.users.root.hashedPassword = my.secrets.users.root.hashedPassword;
|
||||
users.users.ambroisie = {
|
||||
hashedPassword = my.secrets.users.ambroisie.hashedPassword;
|
||||
description = "Bruno BELANYI";
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
openssh.authorizedKeys.keys = with builtins; let
|
||||
keyDir = ../ssh;
|
||||
contents = readDir keyDir;
|
||||
names = attrNames contents;
|
||||
files = filter (name: contents.${name} == "regular") names;
|
||||
keys = map (basename: readFile (keyDir + "/${basename}")) files;
|
||||
in
|
||||
keys;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue