Add home-manager and fix worf

This commit is contained in:
Felix Albrigtsen 2023-07-26 10:48:52 +02:00
parent 5418ca30f0
commit fc2f95035d
4 changed files with 112 additions and 21 deletions

View File

@ -1,5 +1,26 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1687871164,
"narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -7,11 +28,11 @@
]
},
"locked": {
"lastModified": 1690247892,
"narHash": "sha256-WMGc1yq1cqRd+kzjWgbvHxckJIe8VQfiZ5RfR8tgABw=",
"lastModified": 1690329015,
"narHash": "sha256-cyRYHECh8JQL0HPW2LBEPtfmJ6oHZ6SrKgFvUXoUCAw=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "efd35d99ce412335c478dff9da9a4256bbd39757",
"rev": "1c1dd8b0703feda8e7f1e7753088ae8307df5993",
"type": "github"
},
"original": {
@ -23,11 +44,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1687573514,
"narHash": "sha256-jek0ezqxfiFPALhimRDBzgGOSgDv7ExZFhPDmAXoIsw=",
"lastModified": 1690333178,
"narHash": "sha256-y1AabHa5VZnpmH9ARvutQbwUY9K9QbRuXNrZ3HOFaDk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3ef8b37f59cf2e0b57371df726f3c0ecacfa0e73",
"rev": "a0e03cef9344e68c44abea2194173eaf44253fd3",
"type": "github"
},
"original": {
@ -39,11 +60,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1687031877,
"narHash": "sha256-yMFcVeI+kZ6KD2QBrFPNsvBrLq2Gt//D0baHByMrjFY=",
"lastModified": 1690066826,
"narHash": "sha256-6L2qb+Zc0BFkh72OS9uuX637gniOjzU6qCDBpjB2LGY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e2e2059d19668dab1744301b8b0e821e3aae9c99",
"rev": "ce45b591975d070044ca24e3003c830d26fea1c8",
"type": "github"
},
"original": {
@ -55,6 +76,7 @@
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
@ -69,11 +91,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1687398569,
"narHash": "sha256-e/umuIKFcFtZtWeX369Hbdt9r+GQ48moDmlTcyHWL28=",
"lastModified": 1690199016,
"narHash": "sha256-yTLL72q6aqGmzHq+C3rDp3rIjno7EJZkFLof6Ika7cE=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "2ff6973350682f8d16371f8c071a304b8067f192",
"rev": "c36df4fe4bf4bb87759b1891cab21e7a05219500",
"type": "github"
},
"original": {
@ -84,11 +106,11 @@
},
"unstable": {
"locked": {
"lastModified": 1687639213,
"narHash": "sha256-m/jb2D62UXMPy8LeiF39/qGbDBpNpix/h7ne1EXRl9M=",
"lastModified": 1690327932,
"narHash": "sha256-Fv7PYZxN4eo0K6zXhHG/vOc+e2iuqQ5ywDrh0yeRjP0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8eef75145e6c3beada369aee48bd9c2c3a4dee88",
"rev": "a9b47d85504bdd199e90846622c76aa0bfeabfac",
"type": "github"
},
"original": {

View File

@ -4,14 +4,18 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, unstable, nix-darwin, sops-nix, ... }@inputs:
outputs = { self, nixpkgs, unstable, home-manager, nix-darwin, sops-nix, ... }@inputs:
let
overlay-unstable = final: prev: {
unstable = unstable.legacyPackages.${prev.system};
@ -62,7 +66,13 @@
};
modules = [
./hosts/worf/configuration.nix
# ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
home-manager.darwinModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# home-manager.extraSpecialArgs = { inherit user; };
home-manager.users."felixalb" = import ./hosts/worf/home.nix;
}
# sops-nix.nixosModules.sops
];
};

View File

@ -1,12 +1,21 @@
{ pkgs, ... }:
{
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
# Many settings should be handled by home manager. System-wide settings are however managed here.
# System packages for all users
environment.systemPackages = [
pkgs.neovim
pkgs.iterm2
pkgs.ripgrep
pkgs.wget
];
users.users.felixalb = {
home = "/Users/felixalb";
shell = pkgs.zsh;
};
programs.zsh.enable = true;
system.activationScripts.postActivation.text = ''sudo chsh -s ${pkgs.zsh}/bin/zsh''; # Since it's not possible to declare default shell, run this command after build
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;

50
hosts/worf/home.nix Normal file
View File

@ -0,0 +1,50 @@
{ pkgs
, lib
, inputs
, config
, ...
}: {
home.packages = with pkgs; [
iterm2
#element-desktop
exa
];
programs = {
zsh = {
enable = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
history.size = 10000;
};
};
# symlinks don't work with finder + spotlight, copy them instead
disabledModules = [ "targets/darwin/linkapps.nix" ];
home.activation = lib.mkIf pkgs.stdenv.isDarwin {
copyApplications =
let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
baseDir="$HOME/Applications/Home Manager Apps"
if [ -d "$baseDir" ]; then
rm -rf "$baseDir"
fi
mkdir -p "$baseDir"
for appFile in ${apps}/Applications/*; do
target="$baseDir/$(basename "$appFile")"
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
done
'';
};
home.stateVersion = "23.05";
}