Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesplain committed Jul 3, 2024
1 parent 7f60773 commit b0b08d4
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 115 deletions.
73 changes: 45 additions & 28 deletions nixos-config/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

145 changes: 75 additions & 70 deletions nixos-config/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
description = "Example Darwin system flake";

inputs = {

nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

nix-darwin = {
Expand Down Expand Up @@ -40,6 +39,10 @@
url = "github:homebrew/homebrew-cask";
flake = false;
};
mikesplain-homebrew-tap = {
url = "github:mikesplain/homebrew-tap";
flake = false;
};
# homebrew-sk8s = {
# url = "git+file:///Users/mike.splain/developer/homebrew-pdsw-devops";
# flake = false;
Expand All @@ -58,78 +61,83 @@
pwnvim,
...
}: let

user = {
name = "mike.splain";
# timeZone = "Asia/Jakarta";
# locale = "en_GB.UTF-8";
};

configuration = {
nix = {
nix.settings = { experimental-features = "nix-command flakes"; };
nixpkgs = {
config = { allowUnfree = true; };
overlays = [
nur.overlay
(final: prev: {
pwnvim = inputs.pwnvim.packages.${final.system}.pwnvim;
})

];
};
user = {
name = "mike.splain";
# timeZone = "Asia/Jakarta";
# locale = "en_GB.UTF-8";
};

configuration = {
nix = {
nix.settings = {experimental-features = "nix-command flakes";};
nixpkgs = {
config = {allowUnfree = true;};
overlays = [
nur.overlay
(final: prev: {
pwnvim = inputs.pwnvim.packages.${final.system}.pwnvim;
})
];
};
};

environment.systemPackages = with nixpkgs; [
zoxide
inputs.pwnvim.packages."${final.system}".default
];

homeManager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = { inherit inputs user pwnvim; };
users.${user.name} = { imports = [ ./home ]; };
};
system = { system, hostName, osVersion }: let
inherit (nixpkgs.lib.strings) hasInfix;
platform = {
isDarwin = hasInfix "darwin" system;
isLinux = hasInfix "linux" system;
isx86_64 = hasInfix "x86_64" system;
isArm = hasInfix "aarch64" system;
environment.systemPackages = with nixpkgs; [
zoxide
inputs.pwnvim.packages."${final.system}".default
];

homeManager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = {inherit inputs user pwnvim;};
users.${user.name} = {imports = [./home];};
};
modules = if platform.isDarwin
then [
configuration.nix
./platforms/darwin/configuration.nix
./modules
home-manager.darwinModules.home-manager {
users.users.${user.name}.home = "/Users/${user.name}";
home-manager = configuration.homeManager;
system = {
system,
hostName,
osVersion,
}: let
inherit (nixpkgs.lib.strings) hasInfix;
platform = {
isDarwin = hasInfix "darwin" system;
isLinux = hasInfix "linux" system;
isx86_64 = hasInfix "x86_64" system;
isArm = hasInfix "aarch64" system;
};
modules =
if platform.isDarwin
then [
configuration.nix
./platforms/darwin/configuration.nix
./modules
home-manager.darwinModules.home-manager
{
users.users.${user.name}.home = "/Users/${user.name}";
home-manager = configuration.homeManager;
}
]
else [
# configuration.nix
# ./platforms/linux/configuration.nix
# ./hosts/${hostName}/hardware-configuration.nix
# ./modules
# home-manager.nixosModules.home-manager {
# home-manager = configuration.homeManager;
# }
];
specialArgs = {inherit inputs hostName osVersion platform system user;};
in
if platform.isDarwin
then
nix-darwin.lib.darwinSystem {
inherit system modules specialArgs;
}
]
else [
# configuration.nix
# ./platforms/linux/configuration.nix
# ./hosts/${hostName}/hardware-configuration.nix
# ./modules
# home-manager.nixosModules.home-manager {
# home-manager = configuration.homeManager;
# }
];
specialArgs = { inherit inputs hostName osVersion platform system user; };
in if platform.isDarwin
then nix-darwin.lib.darwinSystem {
inherit system modules specialArgs;
}
else nixpkgs.lib.nixosSystem {
inherit system modules specialArgs;
};
else
nixpkgs.lib.nixosSystem {
inherit system modules specialArgs;
};
};

# # Source: https://github.com/computercam/_unixconf_nix/blob/master/flake.nix
# globalModules = [
# {
Expand Down Expand Up @@ -166,7 +174,6 @@
# # }
# # agenix.darwinModules.default
# ];

in {
darwinConfigurations = {
SNS005454 = configuration.system {
Expand All @@ -182,7 +189,6 @@
# username = "mike.splain";
};


# SNS005454 = nix-darwin.lib.darwinSystem {
# system = "aarch64-darwin";
# specialArgs = { inherit inputs; };
Expand All @@ -205,7 +211,6 @@
# ++ [ ./hosts/default/configuration.nix ];
# };


# silicontundra = nix-darwin.lib.darwinSystem {
# system = "aarch64-darwin";
# modules = globalModulesMacos
Expand Down
Loading

0 comments on commit b0b08d4

Please sign in to comment.