start work on darwin shenanigans

This commit is contained in:
ChaotiCryptidz 2022-03-02 17:28:05 +00:00
parent ac51f8cdb5
commit 50cb86227a
No known key found for this signature in database
8 changed files with 141 additions and 42 deletions

9
MAC_VM_SETUP_GUIDE.md Normal file
View file

@ -0,0 +1,9 @@
# Mac VM Setup Guide
## First Install
### Install Nix
```
sh <(curl -L https://nixos.org/nix/install) --no-daemon
```
### Bootstrap

View file

@ -4,7 +4,7 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-unstable"
], ],
"utils": "utils" "utils": "utils"
}, },
@ -54,18 +54,39 @@
"type": "github" "type": "github"
} }
}, },
"home-manager": { "home-manager-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-darwin"
] ]
}, },
"locked": { "locked": {
"lastModified": 1645796113, "lastModified": 1643933536,
"narHash": "sha256-s1WSYeOSIO/I/rII6H9o68naHAWieLzvtqrp8w4ggbI=", "narHash": "sha256-yRmsWAG4DnLxLIUtlaZsl0kH7rN5xSoyNRlf0YZrcH4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "662350bee2090edc82b4c162b1415f76b4eee2f3", "rev": "2860d7e3bb350f18f7477858f3513f9798896831",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-21.11",
"repo": "home-manager",
"type": "github"
}
},
"home-manager-unstable": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1645970334,
"narHash": "sha256-6nn4YF9bPtkxkB7bM6yJO3m//p3sGilxNQFjm1epLEM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ea85f4b1fdf3f25cf97dc49f4a9ec4eafda2ea25",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -78,7 +99,7 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-unstable"
], ],
"utils": "utils_2" "utils": "utils_2"
}, },
@ -96,13 +117,50 @@
"type": "gitlab" "type": "gitlab"
} }
}, },
"nixpkgs": { "nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-darwin"
]
},
"locked": { "locked": {
"lastModified": 1645433236, "lastModified": 1645293039,
"narHash": "sha256-4va4MvJ076XyPp5h8sm5eMQvCrJ6yZAbBmyw95dGyw4=", "narHash": "sha256-PwdDu+SkX8dreeuJ/4av1sEluNZdrpdXv8JsRKKg1Yc=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "1df878b6f8351795a3bebfbe4fd2d02e1e8b29d6",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs-darwin": {
"locked": {
"lastModified": 1646044487,
"narHash": "sha256-2BN9xRr3NeLL9x9X66DiSATzm4nA/G0inc5D0+FtHTA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7f9b6e2babf232412682c09e57ed666d8f84ac2d", "rev": "321b67a7448c79a110af2b9eceb0ad4b28f9db8c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-21.11-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1646159311,
"narHash": "sha256-ILKckkiG074t3a0pwaPLjio8zVWgowpEp7AUwI5HjHE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "18bd82edcc752d6a0e6cce1401ba0c81353a03ca",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -115,9 +173,12 @@
"root": { "root": {
"inputs": { "inputs": {
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"home-manager": "home-manager", "home-manager-darwin": "home-manager-darwin",
"home-manager-unstable": "home-manager-unstable",
"musicutil": "musicutil", "musicutil": "musicutil",
"nixpkgs": "nixpkgs" "nix-darwin": "nix-darwin",
"nixpkgs-darwin": "nixpkgs-darwin",
"nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },
"utils": { "utils": {

View file

@ -2,14 +2,23 @@
description = "NixOS configuration"; description = "NixOS configuration";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # nixpkgs Unstable Inputs
home-manager.url = "github:nix-community/home-manager"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager-unstable.url = "github:nix-community/home-manager";
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
# for darwin
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-21.11-darwin";
home-manager-darwin.url = "github:nix-community/home-manager/release-21.11";
home-manager-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; deploy-rs.inputs.nixpkgs.follows = "nixpkgs-unstable";
musicutil.url = "gitlab:ChaotiCryptidz/musicutil"; musicutil.url = "gitlab:ChaotiCryptidz/musicutil";
#musicutil.url = "path:/home/chaos/Projects/musicutil"; musicutil.inputs.nixpkgs.follows = "nixpkgs-unstable";
musicutil.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { ... }@inputs: import ./outputs.nix inputs; outputs = { ... }@inputs: import ./outputs.nix inputs;

View file

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
home.packages = with pkgs; [ go gopls go-outline goimports ]; home.packages = with pkgs; [ go gopls go-outline gotools ];
programs.vscode.extensions = with pkgs; [ vscode-extensions.golang.go ]; programs.vscode.extensions = with pkgs; [ vscode-extensions.golang.go ];
} }

View file

@ -1,44 +1,61 @@
{ self, home-manager, nixpkgs, tree, ... }@inputs: { self, nixpkgs-unstable, tree, ... }@inputs:
let let
defaultModules = [ defaultModules = [
home-manager.nixosModules.home-manager # NO_INLINE
tree.impure.modules.nixos tree.impure.modules.nixos
tree.impure.profiles.base tree.impure.profiles.base
]; ];
defaultModulesNixOSUnstable = defaultModules ++ [
# NO_INLINE
inputs.home-manager-unstable.nixosModules.home-manager
];
defaultSpecialArgs = { defaultSpecialArgs = {
tree = tree.impure; tree = tree.impure;
pureTree = tree.pure; pureTree = tree.pure;
inherit inputs;
}; };
defaultSpecialArgsNixOSUnstable = defaultSpecialArgs // {
inputs = inputs // {
# set these to the correct versions from inputs
nixpkgs = inputs.nixpkgs-unstable;
home-manager = inputs.home-manager-unstable;
};
};
nixosUnstableSystem = nixpkgs-unstable.lib.nixosSystem;
in { in {
lappy = nixpkgs.lib.nixosSystem { lappy = nixosUnstableSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgsNixOSUnstable;
system = "x86_64-linux"; system = "x86_64-linux";
modules = defaultModules ++ [ ./lappy/lappy.nix ./lappy/hardware.nix ]; modules = defaultModulesNixOSUnstable
++ [ ./lappy/lappy.nix ./lappy/hardware.nix ];
}; };
lappy-vm = nixpkgs.lib.nixosSystem { lappy-vm = nixosUnstableSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgsNixOSUnstable;
system = "x86_64-linux"; system = "x86_64-linux";
modules = defaultModules ++ [ ./lappy/lappy.nix ./lappy/vm.nix ]; modules = defaultModulesNixOSUnstable
++ [ ./lappy/lappy.nix ./lappy/vm.nix ];
}; };
rescue-x86_64 = nixpkgs.lib.nixosSystem { rescue-x86_64 = nixosUnstableSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgsNixOSUnstable;
system = "x86_64-linux"; system = "x86_64-linux";
modules = defaultModules ++ [ ./rescue/rescue.nix ]; modules = defaultModulesNixOSUnstable ++ [ ./rescue/rescue.nix ];
}; };
hetzner-vm = nixpkgs.lib.nixosSystem { hetzner-vm = nixosUnstableSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgsNixOSUnstable;
system = "x86_64-linux"; system = "x86_64-linux";
modules = defaultModules ++ [ ./hetzner-vm/hetzner-vm.nix ]; modules = defaultModulesNixOSUnstable ++ [ ./hetzner-vm/hetzner-vm.nix ];
}; };
# nix --no-sandbox build .#nixosConfigurations.raspberry.config.system.build.sdImage # nix --no-sandbox build .#nixosConfigurations.raspberry.config.system.build.sdImage
raspberry = nixpkgs.lib.nixosSystem { raspberry = nixosUnstableSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgsNixOSUnstable;
system = "aarch64-linux"; system = "aarch64-linux";
modules = defaultModules ++ [ ./raspberry/raspberry.nix ]; modules = defaultModulesNixOSUnstable ++ [ ./raspberry/raspberry.nix ];
}; };
} }

View file

@ -1,7 +1,7 @@
{ self, nixpkgs, home-manager, deploy-rs, ... }@inputs: { self, nixpkgs-unstable, deploy-rs, ... }@inputs:
let let
mkTree = import ./tree.nix { inherit (nixpkgs) lib; }; mkTree = import ./tree.nix { inherit (nixpkgs-unstable) lib; };
pkgs-x86_64-linux = nixpkgs.legacyPackages.x86_64-linux; pkgs-x86_64-linux = nixpkgs-unstable.legacyPackages.x86_64-linux;
tree = mkTree { tree = mkTree {
inherit inputs; inherit inputs;
folder = ./.; folder = ./.;

View file

@ -13,7 +13,7 @@ _: {
"default.clock.rate" = "48000"; "default.clock.rate" = "48000";
}; };
}; };
wireplumber.enable = false;
media-session.enable = true; media-session.enable = true;
media-session.config.bluez-monitor.rules = [ media-session.config.bluez-monitor.rules = [
{ {

3
scripts/nixFlakes.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
nix-shell -p nixFlakes --run "nix --experimental-features \"nix-command flakes\" $@"