Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
esselius committed Mar 26, 2024
1 parent 9d86ba3 commit cede3f3
Show file tree
Hide file tree
Showing 10 changed files with 632 additions and 160 deletions.
518 changes: 458 additions & 60 deletions flake.lock

Large diffs are not rendered by default.

179 changes: 117 additions & 62 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
home-manager.url = "github:nix-community/home-manager";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin";
nixpkgs_rpi.url = "github:nixos/nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-darwin.url = "github:lnl7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";

nixGL = { url = "github:guibou/nixGL"; flake = false; };
dns-heaven = { url = "github:jduepmeier/dns-heaven?rev=3a38e6cb0430753b579490b8bd4652e3fda5fc5d"; flake = false; };
};

outputs = { self, nixpkgs, home-manager, flake-utils, nix-darwin, nixGL, dns-heaven, devenv }@inputs:
outputs = { self, nixpkgs, home-manager, flake-utils, nix-darwin, nixGL, dns-heaven, devenv, flake-parts, nixpkgs_rpi }@inputs:
let
inherit (nix-darwin.lib) darwinSystem;
inherit (home-manager.lib) homeManagerConfiguration;

nixpkgsConfig = { system }: {
inherit system;
config.allowUnfree = true;
Expand All @@ -26,71 +25,127 @@
(import ./overlays/devenv.nix inputs)
];
};
inherit (nix-darwin.lib) darwinSystem;
in
flake-parts.lib.mkFlake { inherit inputs; }
{
flake =
let
nixpkgsModule = args: {
nixpkgs = nixpkgsConfig args;
nix.registry.nixpkgs.flake = nixpkgs;
};

nixpkgsModule = args: {
nixpkgs = nixpkgsConfig args;
nix.registry.nixpkgs.flake = nixpkgs;
};
homeModules = {
imports = [
./modules/home-asdf.nix
./modules/home-base.nix
./modules/home-desktop.nix
./modules/home-git.nix
./modules/home-manual.nix
./modules/home-packages.nix
./modules/home-shell.nix
];
};

nixpkgsForSystem = args: import nixpkgs (nixpkgsConfig args);
homeConfigModule = { user }: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.${user} = homeModules;
};
};

homeModules = {
imports = [
./modules/home-asdf.nix
./modules/home-base.nix
./modules/home-desktop.nix
./modules/home-git.nix
./modules/home-manual.nix
./modules/home-packages.nix
./modules/home-shell.nix
];
};
darwinConfig = { system, user }: darwinSystem {
inherit system inputs;
modules = [
(nixpkgsModule { inherit system; })

homeConfigModule = { user }: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.${user} = homeModules;
};
};
./modules/darwin-desktop.nix
./modules/darwin-dns-heaven.nix
./modules/darwin-homebrew.nix
./modules/darwin-nix.nix
./modules/darwin-shell.nix
./modules/darwin-vpn.nix

homeConfig = { username, system, homeDirectory }: homeManagerConfiguration {
inherit system username homeDirectory;
pkgs = nixpkgsForSystem { inherit system; };
configuration = homeModules;
};
(import ./modules/darwin-user.nix user)
home-manager.darwinModule
(homeConfigModule { user = user; })
];
};
in
{
darwinConfigurations.Pepps-MacBook-Pro = darwinConfig { system = "x86_64-darwin"; user = "peteresselius"; };
darwinConfigurations.Fox = darwinConfig { system = "aarch64-darwin"; user = "peteresselius"; };
darwinConfigurations.Petere-MBP = darwinConfig { system = "aarch64-darwin"; user = "peteresselius"; };

darwinConfig = { system, user }: darwinSystem {
inherit system inputs;
};
systems = [
"x86_64-linux"
"aarch64-darwin"
];
perSystem = { config, system, pkgs, ... }:
{
apps.darwin-rebuild = flake-utils.lib.mkApp { drv = pkgs.writers.writeBashBin "darwin-rebuild" ''${(nix-darwin.lib.darwinSystem {modules = []; inherit system; }).system}/sw/bin/darwin-rebuild "$@"''; };
apps.home-manager = flake-utils.lib.mkApp { drv = home-manager.defaultPackage.${system}; };
};
} // rec {
nixosConfigurations.rpi = nixpkgs_rpi.lib.nixosSystem {
modules = [
(nixpkgsModule { inherit system; })
"${nixpkgs_rpi}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
"${nixpkgs_rpi}/nixos/modules/profiles/minimal.nix"
({ lib, pkgs, ... }: {
nixpkgs.hostPlatform = { system = "armv6l-linux"; gcc = { arch = "armv6k"; fpu = "vfp"; }; };
nixpkgs.buildPlatform.system = "aarch64-linux";

system.stateVersion = "23.11";

./modules/darwin-desktop.nix
./modules/darwin-dns-heaven.nix
./modules/darwin-homebrew.nix
./modules/darwin-nix.nix
./modules/darwin-shell.nix
./modules/darwin-vpn.nix
# https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
boot.supportedFilesystems = lib.mkForce [ "vfat" "ext4" ];
services.openssh.enable = true;
security.sudo.wheelNeedsPassword = false;
users.users.pepp = {
uid = 1000;
isNormalUser = true;
extraGroups = [ "wheel" ];
password = "lol123";
};
networking.useDHCP = true;
nix.settings.trusted-users = [ "root" "@wheel" ];
services.mosquitto = {
enable = true;
listeners = [
{
acl = [ "pattern readwrite #" ];
omitPasswordAuth = true;
settings.allow_anonymous = true;
}
];
};

(import ./modules/darwin-user.nix user)
home-manager.darwinModule
(homeConfigModule { user = user; })
networking.firewall = {
enable = true;
allowedTCPPorts = [ 1883 ];
};
# services.step-ca = {
# enable = true;
# intermediatePasswordFile = "/run/keys/smallstep-password";
# };
# environment.defaultPackages = with pkgs; [
# step-ca
# step-cli
# # yubikey-manager
# ];
})
];
};
in
{
darwinConfigurations.Pepps-MacBook-Pro = darwinConfig { system = "x86_64-darwin"; user = "peteresselius"; };
darwinConfigurations.Fox = darwinConfig { system = "aarch64-darwin"; user = "peteresselius"; };
darwinConfigurations.Petere-MBP = darwinConfig { system = "aarch64-darwin"; user = "peteresselius"; };

} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgsForSystem { inherit system; };
in
{
apps.darwin-rebuild = flake-utils.lib.mkApp { drv = pkgs.writers.writeBashBin "darwin-rebuild" ''${(nix-darwin.lib.darwinSystem {modules = []; inherit system; }).system}/sw/bin/darwin-rebuild "$@"''; };
apps.home-manager = flake-utils.lib.mkApp { drv = home-manager.defaultPackage.${system}; };
}
));
images.rpi = nixosConfigurations.rpi.config.system.build.sdImage;
};
}
2 changes: 1 addition & 1 deletion modules/darwin-desktop.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, pkgs, ... }:
{ pkgs, ... }:

{
services = {
Expand Down
42 changes: 22 additions & 20 deletions modules/darwin-homebrew.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
];

casks = [
"1password"
"1password-beta"
"alfred"
"chromedriver"
"cyberduck"
"datagrip"
# "chromedriver"
# "cyberduck"
# "datagrip"
"docker"
"geekbench"
"goland"
# "goland"
"google-chrome"
"google-cloud-sdk"
"houseparty"
"intellij-idea"
"intune-company-portal"
# "google-cloud-sdk"
# "houseparty"
# "intellij-idea"
# "intune-company-portal"
"istat-menus"
"joplin"
"microsoft-teams"
"parallels"
"pop"
# "joplin"
# "microsoft-teams"
# "parallels"
# "pop"
"screens-connect"
"screens"
"slack"
Expand All @@ -47,22 +47,24 @@
"viscosity"
"dropbox"
"1password-cli"
"dataspell"
"macfuse"
# "dataspell"
# "macfuse"
"notion"
"obsidian"
"odbc-manager"
# "obsidian"
# "odbc-manager"
"plex-media-server"
"visual-studio-code"
"vlc"
"qgis"
] ++ (if pkgs.system == "x86_64-darwin" then [ "intel-power-gadget" ] else [ ]);

brews = [
"azure-cli"
"dhall-yaml"
"duckdb"
# "azure-cli"
# "dhall-yaml"
# "duckdb"
"hub"
"xz"
"nmrpflash"
];
};
}
21 changes: 17 additions & 4 deletions modules/darwin-nix.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
{ pkgs, ... }:

{
nix = {
useDaemon = true;
settings = {
sandbox = true;
trusted-users = ["root" "@admin"];
sandbox = false;
trusted-users = [ "@admin" ];
};
extraOptions = ''
extra-experimental-features = nix-command flakes
warn-dirty = false
'';
configureBuildUsers = true;

linux-builder = {
enable = true;
maxJobs = 8;
ephemeral = true;
config = {
virtualisation = {
darwin-builder = {
diskSize = 100 * 1024;
memorySize = 16 * 1024;
};
cores = 8;
};
};
};
};

services.nix-daemon.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion modules/darwin-vpn.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
services.dns-heaven.enable = true;
services.dns-heaven.enable = false;
}
2 changes: 1 addition & 1 deletion modules/home-desktop.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:
{
programs = {
kitty = {
Expand Down
2 changes: 1 addition & 1 deletion modules/home-git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

git = {
enable = true;
lfs.enable = true;
lfs.enable = false;

userName = "Peter Esselius";
userEmail = "[email protected]";
Expand Down
22 changes: 13 additions & 9 deletions modules/home-packages.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:
let
globalPackages = with pkgs; [
ripgrep
fzf
vagrant
packer
# vagrant
# packer
stern
vim
kubectl
watch
kustomize
clickhouse-cli
# kustomize
# clickhouse-cli
jq
google-cloud-sdk
docker-compose
(sbt.override { jre = jre8; })
# (flink.override { jre = jre8; })
jdk
kind
kubernetes-helm
# kubernetes-helm
gnumake
krew
tilt
Expand All @@ -33,11 +33,15 @@ let
gopls
delve
earthly
octant
# octant
minio-client
nil
];
linuxPackages = with pkgs; [ ];
darwinPackages = with pkgs; [ ];
linuxPackages = [ ];
darwinPackages = with pkgs; [
# tart
utm
];
in
{
home = {
Expand Down
2 changes: 1 addition & 1 deletion modules/home-shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ pkgs, ... }:
{
programs = {
fish = {
Expand Down

0 comments on commit cede3f3

Please sign in to comment.