Basic migration to home manager

This commit is contained in:
Nathan McCarty 2022-02-03 14:00:50 -05:00
parent 5a5061fe97
commit 6db59aa491
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
3 changed files with 129 additions and 47 deletions

View File

@ -34,6 +34,24 @@
"type": "github" "type": "github"
} }
}, },
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1643837728,
"narHash": "sha256-iW/5eMRQmzdctv2dAUlIaZnVWwcmaznNajS+ft1MXHg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9d369c75ce2fdeb296ad42bcdc8c1a523c494550",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"mozilla": { "mozilla": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -83,6 +101,20 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1643472818,
"narHash": "sha256-qzVPxKDUubYIxKRSuDl/JgzXWSmGvUVYny9SxFMfPJM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7f65e4abd5ecaad12d2d26e4380d1a7d8edafea7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1643503720, "lastModified": 1643503720,
"narHash": "sha256-tJic20ufuRnG8V+fTCd3YU6xl1ImxNspoEkXHct0AG4=", "narHash": "sha256-tJic20ufuRnG8V+fTCd3YU6xl1ImxNspoEkXHct0AG4=",
@ -98,7 +130,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1638097282, "lastModified": 1638097282,
"narHash": "sha256-EXCzj9b8X/lqDPJapxZThIOKL5ASbpsJZ+8L1LnY1ig=", "narHash": "sha256-EXCzj9b8X/lqDPJapxZThIOKL5ASbpsJZ+8L1LnY1ig=",
@ -118,8 +150,9 @@
"inputs": { "inputs": {
"emacs": "emacs", "emacs": "emacs",
"fenix": "fenix", "fenix": "fenix",
"home-manager": "home-manager",
"mozilla": "mozilla", "mozilla": "mozilla",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_3",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
@ -143,7 +176,7 @@
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1643003126, "lastModified": 1643003126,

View File

@ -15,18 +15,19 @@
flake = false; flake = false;
}; };
sops-nix.url = "github:Mic92/sops-nix"; sops-nix.url = "github:Mic92/sops-nix";
home-manager.url = "github:nix-community/home-manager";
}; };
outputs = { self, nixpkgs, nixpkgs-unstable, fenix, emacs, mozilla, sops-nix }: outputs = { self, nixpkgs, nixpkgs-unstable, fenix, emacs, mozilla, sops-nix, home-manager }:
let let
coreModules = [ coreModules = [
./modules/user.nix
./modules/common.nix ./modules/common.nix
./modules/ssh.nix ./modules/ssh.nix
./applications/utils-core.nix ./applications/utils-core.nix
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
({ pkgs, ... }: { home-manager.nixosModules.home-manager
## Setup binary caches ## Setup binary caches
({ pkgs, ... }: {
# First install cachix, so we can discover new ones # First install cachix, so we can discover new ones
environment.systemPackages = [ pkgs.cachix ]; environment.systemPackages = [ pkgs.cachix ];
# Then configure up the nix community cache # Then configure up the nix community cache
@ -41,14 +42,103 @@
}) })
## Setup sops ## Setup sops
({ pkgs, config, ... }: { ({ pkgs, config, ... }: {
# Add default secrets
sops.defaultSopsFile = ./secrets/nathan.yaml; sops.defaultSopsFile = ./secrets/nathan.yaml;
# Use system ssh key as an age key
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# Load up lastfm scrobbling secret
sops.secrets.lastfm-conf = { sops.secrets.lastfm-conf = {
owner = "nathan"; owner = "nathan";
format = "binary"; format = "binary";
sopsFile = ./secrets/lastfm.conf; sopsFile = ./secrets/lastfm.conf;
}; };
}) })
## Setup home manager
({ pkgs, config, ... }:
let
unstable = import nixpkgs-unstable {
config = { allowUnfree = true; };
overlays = [ emacs.overlay mozillaOverlay ];
system = "x86_64-linux";
};
in
{
## Some general settings that were in the user configuration
# Set time zone
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# enable sudo
security.sudo.enable = true;
## Setup user first
users = {
mutableUsers = false;
users.nathan = {
isNormalUser = true;
home = "/home/nathan";
description = "Nathan McCarty";
extraGroups = [ "wheel" "networkmanager" "audio" "docker" "libvirtd" "uinput" "adbusers" ];
hashedPassword = "$6$ShBAPGwzKZuB7eEv$cbb3erUqtVGFo/Vux9UwT2NkbVG9VGCxJxPiZFYL0DIc3t4GpYxjkM0M7fFnh.6V8MoSKLM/TvOtzdWbYwI58.";
};
};
## Home manager proper
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.nathan = {
## Shell
# Shell proper
programs.fish = {
enable = true;
# Use latest possible fish
package = unstable.fish;
# Setup our aliases
shellAliases = {
ls = "exa --icons";
};
# Custom configuration
interactiveShellInit = ''
# Setup any-nix-shell
any-nix-shell fish --info-right | source
'';
};
# Starship, for the prompt
programs.starship = {
enable = true;
settings = {
directory = {
truncation_length = 3;
fish_style_pwd_dir_length = 1;
};
git_commit = {
commit_hash_length = 6;
only_detached = false;
};
package = {
symbol = "";
};
time = {
disabled = false;
format = "[$time]($style)";
time_format = "%I:%M %p";
};
};
};
};
};
## Misc packages that were in user.nix
# Install general use packages
environment.systemPackages = with pkgs; [
# Install our shell of choice
unstable.fish
# Install rclone
rclone
];
})
]; ];
desktopModules = coreModules ++ [ desktopModules = coreModules ++ [
./modules/audio.nix ./modules/audio.nix

View File

@ -1,41 +0,0 @@
# Contains general user environment configuration
{ config, pkgs, unstable, ... }:
{
# Disable mutable users, force everything to go through the flake
users.mutableUsers = false;
# Set time zone
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# enable sudo
security.sudo.enable = true;
# Enable fish as a login shell
environment.shells = [ pkgs.bashInteractive unstable.fish ];
users.users.nathan = {
isNormalUser = true;
home = "/home/nathan";
description = "Nathan McCarty";
extraGroups = [ "wheel" "networkmanager" "audio" "docker" "libvirtd" "uinput" "adbusers" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRs6zVljIlQEZ8F+aEBqqbpeFJwCw3JdveZ8TQWfkev cardno:000615938515"
];
shell = unstable.fish;
hashedPassword = "$6$ShBAPGwzKZuB7eEv$cbb3erUqtVGFo/Vux9UwT2NkbVG9VGCxJxPiZFYL0DIc3t4GpYxjkM0M7fFnh.6V8MoSKLM/TvOtzdWbYwI58.";
};
# Install general use packages
environment.systemPackages = with pkgs; [
# Install our shell of choice
unstable.fish
# Install rclone
rclone
];
}