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": {
"locked": {
"lastModified": 1661700591,
"narHash": "sha256-NZa+z+TJC+Hk+87+LKkjFFmBn4GyMVEPcWFXFU+aTkU=",
"lastModified": 1662874738,
"narHash": "sha256-kG29aU9f5UTWhPf/QEh5LanDmqqbbcErWYAcPptC/Cg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "16236dd7e33ba4579ccd3ca8349396b2f9c960fe",
"rev": "dd1f4d982445a7d1b1869baa42f8f0f9bc606714",
"type": "github"
},
"original": {

View File

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

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";
};
};
}