flake: Refactor profiles system, add vscode

This commit is contained in:
Sam W 2022-09-14 18:29:00 +01:00
parent 3720eb175c
commit 80bc6f91a4
5 changed files with 45 additions and 23 deletions

View File

@ -61,11 +61,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1661700591, "lastModified": 1662874738,
"narHash": "sha256-NZa+z+TJC+Hk+87+LKkjFFmBn4GyMVEPcWFXFU+aTkU=", "narHash": "sha256-kG29aU9f5UTWhPf/QEh5LanDmqqbbcErWYAcPptC/Cg=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "16236dd7e33ba4579ccd3ca8349396b2f9c960fe", "rev": "dd1f4d982445a7d1b1869baa42f8f0f9bc606714",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -28,36 +28,37 @@
in (rec { in (rec {
lib = { lib = {
mkHome = { mkHome = {
profile, profiles,
extraModules ? [],
system, system,
username ? "samw", username ? "samw",
}: }:
inputs.home-manager.lib.homeManagerConfiguration rec { inputs.home-manager.lib.homeManagerConfiguration {
inherit username system; inherit username system;
stateVersion = "21.11"; stateVersion = "21.11";
homeDirectory = homeDirectory =
if (inputs.nixpkgs.lib.systems.elaborate system).isDarwin if (inputs.nixpkgs.lib.systems.elaborate system).isDarwin
then "/Users/${username}" then "/Users/${username}"
else "/home/${username}"; else "/home/${username}";
configuration = {...} @ args: ((profile args) // {nixpkgs.overlays = overlays;}); # In home-manager 22.11 configuration/extraModules go away and are replaced
extraSpecialArgs = {inherit system;}; # by a single "modules". So let's get ready for that.
inherit extraModules; configuration = {...}: {};
extraSpecialArgs = { inherit system; };
extraModules = profiles ++ [{ nixpkgs.overlays = overlays; }];
}; };
}; };
profiles = import ./home/profiles.nix;
# Standalone home-manager configurations # Standalone home-manager configurations
homeConfigurations = { homeConfigurations = let
profiles = import ./home/profiles.nix;
in {
boron = lib.mkHome { boron = lib.mkHome {
system = "aarch64-darwin"; system = "aarch64-darwin";
profile = profiles.laptop; profiles = with profiles; [ default dev sensitive mac docker aws ];
username = "samuel.willcocks"; username = "samuel.willcocks";
extraModules = [./home/docker.nix ./home/aws.nix];
}; };
zinc = lib.mkHome { zinc = lib.mkHome {
system = "aarch64-darwin"; system = "aarch64-darwin";
profile = profiles.laptop; profiles = with profiles; [ default dev sensitive mac ];
}; };
}; };
} }

View File

@ -1,18 +1,23 @@
{ {
# The basics that you'll want everywhere
default = ./default.nix;
# A machine for development
dev = {...}: { dev = {...}: {
imports = [./default.nix ./git.nix ./rust.nix ./vim.nix ./vim-dev]; imports = [ ./git.nix ./rust.nix ./vim.nix ./vim-dev ./vscode.nix ];
}; };
laptop = {...}: { # Sensitive stuff
sensitive = {...}: {
imports = [ imports = [
./default.nix
./git.nix
./macs.nix
./rust.nix
./vim.nix
./vim-dev
./passwords.nix ./passwords.nix
./gpg.nix ./gpg.nix
]; ];
}; };
# A MacOS machine
mac = ./macs.nix;
# A machine you want to do docker stuff on
docker = ./docker.nix;
# A machine you want to do aws stuff on
aws = ./aws.nix;
# A server
server = {...}: {imports = [./default.nix ./git.nix ./vim.nix];}; server = {...}: {imports = [./default.nix ./git.nix ./vim.nix];};
} }

16
home/vscode.nix Normal file
View File

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
package = pkgs.vscodium;
mutableExtensionsDir = false;
extensions = with pkgs.vscode-extensions; [
matklad.rust-analyzer
jdinhlife.gruvbox
];
userSettings = {
"update.mode" = "none";
"workbench.colorTheme" = "Gruvbox Dark Hard";
};
};
}