33 Commits

Author SHA1 Message Date
dependabot[bot]
166ef06a35 Bump actions/checkout from 3 to 4 (#22)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 09:09:19 +01:00
dependabot[bot]
b07f725d3d Bump cachix/install-nix-action from 22 to 23 (#23)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 22 to 23.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v22...v23)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 09:07:16 +01:00
dependabot[bot]
4b3f3f886b Bump cachix/install-nix-action from 17 to 22 (#21)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 17 to 22.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v17...v22)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 08:40:18 +01:00
Patrick Stevens
028225eca7 Add more linting (#20) 2023-08-28 20:25:01 +01:00
Patrick Stevens
b343f6bb01 Add config for Earthworm (#19) 2023-08-28 19:52:17 +01:00
Patrick Stevens
2cd767ae5b Add rg, poetry, woodpecker-agent, stable Emacs, upstreamed VSCode plugins (#18) 2023-08-28 11:18:05 +01:00
Patrick Stevens
44856ee782 Many updates (#16) 2023-04-01 09:00:45 +01:00
Patrick Stevens
36171014c8 Split into multiple configs (#10) 2022-11-24 20:07:50 +00:00
Patrick Stevens
df297beff1 Add VSCode pull-requests extension, add more libraries to Rust flags (#15) 2022-11-24 19:42:41 +00:00
Patrick Stevens
4e6c9b03af Add PR checks (#14) 2022-11-24 19:30:04 +00:00
Patrick Stevens
460af9d007 Flake update (#13) 2022-11-24 19:24:38 +00:00
Patrick Stevens
b72a716083 Better gitignore for darwin (#12) 2022-11-24 19:15:06 +00:00
Patrick Stevens
f1d917d4ec Add JSON reformat to init.vim (#11) 2022-11-24 19:13:39 +00:00
Patrick Stevens
f4678f910f General faff (#9) 2022-08-20 21:45:49 +01:00
Smaug123
cf0dbe7f44 Merge branch 'main' of ssh://ssh.github.com:443/Smaug123/nix-dotfiles 2022-03-17 22:13:20 +00:00
Patrick Stevens
c45a0d9df6 Add yt-dlp config and fix up git diff style (#8)
* Update git diff method

* Bump flake

* Add yt-dlp
2022-03-17 22:13:13 +00:00
Smaug123
d22ad837a0 Bump flake 2022-03-06 15:33:19 +00:00
Smaug123
005de0c62a Update git diff method 2022-03-02 19:14:46 +00:00
Smaug123
c9dd6b03ec Merge branch 'update-extensions' 2022-02-20 10:23:04 +00:00
Smaug123
5fda4e0165 Add config for LaTeX 2022-02-20 10:22:33 +00:00
Smaug123
e603de3347 Update VSCode extensions 2022-02-20 09:54:34 +00:00
Smaug123
fc0987c71e Merge branch 'main' of github.com:Smaug123/nix-dotfiles 2022-02-20 09:46:44 +00:00
Patrick Stevens
76b0a99899 Update Nixpkgs (#7) 2022-02-20 09:46:28 +00:00
Smaug123
9071035ba2 Format 2022-02-18 20:02:50 +00:00
Patrick Stevens
2463b3275b Use flakes (#6) 2022-02-06 14:40:14 +00:00
Smaug123
278ef5278d Remove ca-derivations again 2022-02-06 13:06:46 +00:00
Smaug123
cf971dbbb9 Lean 4 2022-02-05 10:21:46 +00:00
Smaug123
73539bc753 Fix up some config 2022-02-04 19:58:13 +00:00
Smaug123
4cdf00f879 A few bits and bobs 2022-01-26 20:17:50 +00:00
Smaug123
49b4432235 Upgrade extensions 2022-01-16 22:59:35 +00:00
Smaug123
135a036dd8 Add imagemagick 2022-01-16 22:56:38 +00:00
Smaug123
4e0ed30fbf Upgrade VS Code 2021-12-20 21:35:49 +00:00
Smaug123
40c8093b49 Remove custom GMP setup entirely 2021-12-12 19:10:12 +00:00
35 changed files with 1258 additions and 449 deletions

8
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

50
.github/workflows/lint.yaml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with: { "extra_nix_config": "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" }
- name: "Run Shellcheck"
run: "nix develop --command bash -c \"find . -type f -name '*.sh' | xargs shellcheck\""
format:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with: { "extra_nix_config": "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" }
- name: "Run Alejandra"
run: "nix develop --command alejandra --check ."
flake-check:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install Nix"
uses: "cachix/install-nix-action@v23"
with: { "extra_nix_config": "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" }
- name: "Check flake"
run: "nix flake check --all-systems"
all-required-checks-complete:
runs-on: "ubuntu-latest"
steps:
- run: "echo \"All required checks complete.\""
needs:
- "shellcheck"
- "format"
- "flake-check"

6
.gitignore vendored
View File

@@ -1 +1,5 @@
result/
result
.idea/
bin/
obj/
.DS_Store

16
VsCodeExtensions.sln Normal file
View File

@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "VsCodeExtensions", "VsCodeExtensions\VsCodeExtensions.fsproj", "{5BD60C47-954A-42E3-9863-9B6ED29AC112}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BD60C47-954A-42E3-9863-9B6ED29AC112}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BD60C47-954A-42E3-9863-9B6ED29AC112}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BD60C47-954A-42E3-9863-9B6ED29AC112}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BD60C47-954A-42E3-9863-9B6ED29AC112}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

178
VsCodeExtensions/Program.fs Normal file
View File

@@ -0,0 +1,178 @@
open System.IO
open System.Net.Http
open System.Text.Json
type Extension =
{
Name : string
Publisher : string
Version : string
Sha256 : string
}
override this.ToString () =
[
"{"
$" name = \"{this.Name}\";"
$" publisher = \"{this.Publisher}\";"
$" version = \"{this.Version}\";"
$" sha256 = \"{this.Sha256}\";"
"}"
]
|> String.concat "\n"
static member Parse (s : string list) : Extension =
let collection =
s
|> List.fold (fun fields s ->
match s.Split "=" |> List.ofArray with
| field :: rest when not <| rest.IsEmpty ->
Map.add (field.Trim ()) ((String.concat "=" rest).Split('"').[1].TrimEnd(';')) fields
| _ -> fields
) Map.empty
{
Name = collection.["name"]
Publisher = collection.["publisher"]
Version = collection.["version"]
Sha256 = collection.["sha256"]
}
type Skipped =
{
NixpkgsRef : string
Reason : string
}
override this.ToString () =
[
$"# {this.Reason}"
$"# {this.NixpkgsRef}"
]
|> String.concat "\n"
let bimap f g (x, y) = (f x, g y)
let partition<'a, 'b> (l : List<Choice<'a, 'b>>) : 'a list * 'b list =
l
|> List.fold (fun (aEntries, bEntries) next ->
match next with
| Choice1Of2 a -> (a :: aEntries, bEntries)
| Choice2Of2 b -> (aEntries, b :: bEntries)
) ([], [])
|> bimap List.rev List.rev
type NixFile =
{
NixpkgsRefs : string list
Skipped : Skipped list
SpecificVersions : Extension list
}
override this.ToString () =
[
yield "{ pkgs }:"
yield ""
yield "with pkgs.vscode-extensions; ["
yield! this.NixpkgsRefs |> List.map (sprintf " %s")
yield! this.Skipped |> List.map (sprintf "%O")
yield "] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace ["
yield! this.SpecificVersions |> List.map (sprintf "%O")
yield "]"
]
|> String.concat "\n"
static member Parse (s : string) : NixFile =
let pre, post =
s.Split "++ pkgs.vscode-utils.extensionsFromVscodeMarketplace ["
|> function
| [| pre ; post |] -> pre, post
| _ -> failwith "Unexpected number of '++'"
let verbatim, skipped =
match pre.Split "\n" |> Seq.filter (fun s -> s <> "") |> List.ofSeq with
| pkgsStr :: "with pkgs.vscode-extensions; [" :: rest when pkgsStr.Replace(" ", "") = "{pkgs}:" ->
rest
|> List.map (fun s ->
if s.StartsWith '#' then Choice2Of2 (s.[2..].Trim()) else Choice1Of2 (s.Trim())
)
|> partition
| _ -> failwith $"Unexpected pre:\n{pre}"
let pairs (l : 'a list) : ('a * 'a) list =
let rec go acc l =
match l with
| [] -> acc
| [singleton] -> failwith $"Expected pair, got {singleton}"
| x :: y :: rest -> go ((x, y) :: acc) rest
go [] l
|> List.rev
let skipped =
skipped
|> pairs
|> List.map (fun (comment, link) -> { NixpkgsRef = link ; Reason = comment })
let specificVersions =
post.TrimEnd([| '\n' ; ']'|]).Split "}"
|> Array.choose (fun contents ->
match contents.Trim([|'\n' ; ' '|]).Split "\n" |> List.ofArray with
| "{" :: rest ->
Some (Extension.Parse rest)
| [] ->
failwith $"Expected extension, got:\n{contents}"
| [""] -> None
| fst :: rest ->
failwith $"Expected bracket, got '{fst}'\n {rest}"
)
|> Array.toList
{
Skipped = skipped
NixpkgsRefs = verbatim
SpecificVersions = specificVersions
}
type Version =
{
Version : string
TargetPlatform : string
}
let upgradeExtension (client : HttpClient) (e : Extension) : Extension Async =
let uri = System.Uri $"https://marketplace.visualstudio.com/items?itemName={e.Publisher}.{e.Name}"
async {
let! response = client.GetAsync uri |> Async.AwaitTask
let! content = response.Content.ReadAsStringAsync () |> Async.AwaitTask
let options = JsonSerializerOptions ()
options.PropertyNameCaseInsensitive <- true
let latestVersion =
content.Split("\"Versions\":[").[1].Split("]").[0]
|> sprintf "[%s]"
|> fun s -> JsonSerializer.Deserialize<Version array> (s, options)
|> Seq.head
if latestVersion.Version <> e.Version then
return { e with Version = latestVersion.Version ; Sha256 = "sha256-/000+cQBqzb6QB5+AizlyIcjqNpZ86o2at885hOcro0=" }
else return e
}
let upgrade (nixFile : NixFile) : NixFile =
use client = new HttpClient ()
{ nixFile with
SpecificVersions =
nixFile.SpecificVersions
|> List.map (upgradeExtension client)
|> Async.Parallel
|> Async.RunSynchronously
|> List.ofArray
}
module Program =
[<EntryPoint>]
let main args =
let sourceFile =
if args.Length = 0 then "vscode-extensions.nix" else args.[0]
File.ReadAllText sourceFile
|> NixFile.Parse
|> upgrade
|> string<NixFile>
|> fun s -> File.WriteAllText (sourceFile, s)
0

View File

@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs"/>
</ItemGroup>
</Project>

View File

@@ -2,7 +2,7 @@
install_nix () {
echo "Installing Nix..."
diskutil list > /dev/null || export PATH=/usr/sbin:$PATH
diskutil list > /dev/null || export PATH="/usr/sbin:$PATH"
curl -L https://nixos.org/nix/install | sh -s -- --darwin-use-unencrypted-nix-store-volume --daemon || exit 1
echo "Nix installed."
}
@@ -23,4 +23,4 @@ nix-channel --update || exit 1
darwin-rebuild changelog || install_darwin_build || exit 1
NIX_PATH="darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:/nix/var/nix/profiles/per-user/Patrick/channels:$NIX_PATH" darwin-rebuild switch || exit 1
NIX_PATH="darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:/nix/var/nix/profiles/per-user/patrick/channels:$NIX_PATH" darwin-rebuild switch || exit 1

View File

@@ -1,28 +1,23 @@
{ config, lib, pkgs, ... }:
let python = import ./python.nix { inherit pkgs; }; in
{
{pkgs, ...}: let
python = import ./python.nix {inherit pkgs;};
in {
nix.useDaemon = true;
imports = [ <home-manager/nix-darwin> ];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.Patrick = import ./home.nix;
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[
pkgs.alacritty
pkgs.rustup
pkgs.libiconv
pkgs.clang
#pkgs.keepassxc
python
];
environment.systemPackages = [
pkgs.alacritty
pkgs.rustup
pkgs.libiconv
pkgs.clang
python
];
users.users.patrick = {
home = "/Users/patrick";
name = "patrick";
};
# This line is required; otherwise, on shell startup, you won't have Nix stuff in the PATH.
programs.zsh.enable = true;
@@ -31,25 +26,25 @@ let python = import ./python.nix { inherit pkgs; }; in
# $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
environment.darwinConfig = "$HOME/.nixpkgs/darwin-configuration.nix";
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/emacs-overlay/archive/25dd5297f613fd13971e4847e82d1097077eeb53.tar.gz;
}))
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"vscode"
];
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nixFlakes;
nix.package = pkgs.nixVersions.stable;
nix.gc.automatic = true;
nix.useSandbox = true;
nix.nixPath = ["darwin=/nix/store/zq4v3pi2wsfsrjkpk71kcn8srhbwjabf-nix-darwin"];
# Sandbox causes failure: https://github.com/NixOS/nix/issues/4119
nix.settings.sandbox = false;
nix.extraOptions = ''
auto-optimise-store = true
experimental-features = nix-command flakes
extra-experimental-features = ca-derivations
max-jobs = auto # Allow building multiple derivations in parallel
keep-outputs = true # Do not garbage-collect build time-only dependencies (e.g. clang)
keep-derivations = true
# Allow fetching build results from the Lean Cachix cache
trusted-substituters = https://lean4.cachix.org/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= lean4.cachix.org-1:mawtxSxcaiWE24xCXXgh3qnvlTkyU7evRRnGeAhD4Wk=
'';
# Used for backwards compatibility, please read the changelog before changing.

View File

248
flake.lock generated Normal file
View File

@@ -0,0 +1,248 @@
{
"nodes": {
"apple-silicon": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1693064156,
"narHash": "sha256-EnZntHnlPqWZIoa593zDV4GSkfbLLAL6VAreMvM6JN4=",
"owner": "tpwrules",
"repo": "nixos-apple-silicon",
"rev": "bef25f9cdfd8513a42c175b88a1cb619e3ef5951",
"type": "github"
},
"original": {
"owner": "tpwrules",
"repo": "nixos-apple-silicon",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1692248770,
"narHash": "sha256-tZeFpETKQGbgnaSIO1AGWD27IyTcBm4D+A9d7ulQ4NM=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "511177ffe8226c78c9cf6a92a7b5f2df3684956b",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"emacs": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1693193430,
"narHash": "sha256-6qsW+c7CTlrOkY3PuZksNgNVrRSqUhlA/Uzq7Kb/3IY=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "78ec4983ba820b37fc2e7c998ead39be6bec7f6d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1693187908,
"narHash": "sha256-cTcNpsqi1llmUFl9bmCdD0mTyfjhBrNFPhu2W12WXzA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8bde7a651b94ba30bd0baaa9c4a08aae88cc2e92",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692913444,
"narHash": "sha256-1SvMQm2DwofNxXVtNWWtIcTh7GctEVrS/Xel/mdc6iY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "18324978d632ffc55ef1d928e81630c620f4f447",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "18324978d632ffc55ef1d928e81630c620f4f447",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1693087214,
"narHash": "sha256-Kn1SSqRfPpqcI1MDy82JXrPT1WI8c03TA2F0xu6kS+4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f155f0cf4ea43c4e3c8918d2d327d44777b6cad4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1693097136,
"narHash": "sha256-fBZSMdBaoZ0INFbyZ5s0DOF7zDNcLsLxgkwdDh3l9Pc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9117c4e9dc117a6cd0319cca40f2349ed333669d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1693145325,
"narHash": "sha256-Gat9xskErH1zOcLjYMhSDBo0JTBZKfGS0xJlIRnj6Rc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cddebdb60de376c1bdb7a4e6ee3d98355453fe56",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"apple-silicon": "apple-silicon",
"darwin": "darwin",
"emacs": "emacs",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"sops-nix": "sops-nix"
}
},
"rust-overlay": {
"flake": false,
"locked": {
"lastModified": 1686795910,
"narHash": "sha256-jDa40qRZ0GRQtP9EMZdf+uCbvzuLnJglTUI2JoHfWDc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "5c2b97c0a9bc5217fc3dfb1555aae0fb756d99f9",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1693105804,
"narHash": "sha256-nlqNjW7dfucUJQqRGuG08MKPOSME8fLOCx/bd9hiEPs=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "0618c8f0ed5255ad74ee08d1618841ff5af85c86",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

125
flake.nix Normal file
View File

@@ -0,0 +1,125 @@
{
description = "Patrick's Darwin Nix setup";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin/master";
# url = "github:Smaug123/nix-darwin/extract";
inputs.nixpkgs.follows = "nixpkgs";
};
emacs = {
url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
apple-silicon = {
url = "github:tpwrules/nixos-apple-silicon";
};
};
outputs = {
self,
darwin,
emacs,
nixpkgs,
home-manager,
sops-nix,
apple-silicon,
...
} @ inputs: let
config = {
# contentAddressedByDefault = true;
allowUnfree = true;
};
in let
overlays = [emacs.overlay] ++ import ./overlays.nix;
recursiveMerge = attrList: let
f = attrPath:
builtins.zipAttrsWith (n: values:
if builtins.tail values == []
then builtins.head values
else if builtins.all builtins.isList values
then nixpkgs.lib.unique (builtins.concatLists values)
else if builtins.all builtins.isAttrs values
then f (attrPath ++ [n]) values
else builtins.last values);
in
f [] attrList;
in {
nixosConfigurations = {
earthworm = let
system = "aarch64-linux";
in let
pkgs = import nixpkgs {inherit system config overlays;};
in
nixpkgs.lib.nixosSystem {
inherit system;
modules = let
args = {
nixpkgs = pkgs;
username = "patrick";
dotnet = pkgs.dotnet-sdk_7;
};
in [
./home-manager/earthworm-config.nix
apple-silicon.nixosModules.default
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.patrick = recursiveMerge [(import ./home-manager/earthworm.nix args) (import ./home-manager/home.nix args)];
}
];
};
};
darwinConfigurations = let
system = "aarch64-darwin";
in let
pkgs = import nixpkgs {inherit system config overlays;};
in {
nixpkgs = pkgs;
patrick = darwin.lib.darwinSystem {
system = system;
modules = let
args = {
nixpkgs = pkgs;
username = "patrick";
dotnet = pkgs.dotnet-sdk_7;
};
in [
./darwin-configuration.nix
sops-nix.nixosModules.sops
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.patrick = recursiveMerge [(import ./home-manager/darwin.nix args) (import ./home-manager/home.nix args)];
}
];
};
};
devShells = let
devShell = system: (
let
pkgs = import nixpkgs {inherit config system;};
in {
default = pkgs.mkShell {
buildInputs = [pkgs.alejandra pkgs.shellcheck];
};
}
);
in
builtins.listToAttrs (builtins.map (system: {
name = system;
value = devShell system;
}) ["aarch64-darwin" "aarch64-linux" "x86_64-linux"]);
};
}

View File

@@ -1,36 +0,0 @@
{ pkgs, config, lib, ... }:
let link = ./link.sh; in
let gmp-symlink =
pkgs.stdenv.mkDerivation {
name = "gmp-symlink";
src = ./link.sh;
phases = [ "unpackPhase" ];
unpackPhase = ''
mkdir -p "$out"
cp ${link} "$out/link.sh"
chmod u+x "$out/link.sh"
sed -i 's_NIX-GMP_${config.gmp-symlink.gmp}_' "$out/link.sh"
'';
installPhase = ''
'';
};
in
{
options = {
gmp-symlink.enable = lib.mkOption { default = false; };
gmp-symlink.gmp = lib.mkOption { default = pkgs.gmp; };
};
config = lib.mkIf config.gmp-symlink.enable {
home.activation.gmp-symlink = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
${gmp-symlink}/link.sh
'';
};
}

View File

@@ -1,15 +0,0 @@
#!/bin/bash
dest="/usr/local/opt/gmp/lib/libgmp.10.dylib"
sudo mkdir -p "$(dirname "$dest")"
existing=$(readlink "$dest")
if [ $? -eq 1 ]; then
sudo ln -s "NIX-GMP/lib/libgmp.10.dylib" "$dest"
else
if [[ "$existing" == /nix/store/* ]]; then
sudo ln -fs "NIX-GMP/lib/libgmp.10.dylib" "$dest"
else
echo "Existing symlink is $existing, refusing to overwrite"
exit 1
fi
fi

41
hardware/earthworm.nix Normal file
View File

@@ -0,0 +1,41 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["usb_storage" "sdhci_pci"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/49068d2d-13e6-43b5-a740-f23db6fbd6b2";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/43ED-0FE7";
fsType = "vfat";
};
swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}

View File

@@ -0,0 +1,2 @@
[registries.crates-io]
protocol = "sparse"

40
home-manager/darwin.nix Normal file
View File

@@ -0,0 +1,40 @@
{
nixpkgs,
username,
dotnet,
...
}: {
imports = [./rider];
rider = {
enable = true;
username = username;
dotnet = dotnet;
};
home.packages = [
# "Damaged and can't be opened"
#nixpkgs.bcompare
#nixpkgs.gdb
#nixpkgs.handbrake
];
programs.vscode = {
userSettings = {
"lean.leanpkgPath" = "/Users/${username}/.elan/toolchains/stable/bin/leanpkg";
"lean.executablePath" = "/Users/${username}/.elan/toolchains/stable/bin/lean";
"lean.memoryLimit" = 16384;
"latex-workshop.view.pdf.viewer" = "tab";
"lean4.toolchainPath" = "/Users/${username}/.elan/toolchains/leanprover--lean4---nightly-2022-12-16";
};
};
programs.zsh = {
shellAliases = {
cmake = "cmake -DCMAKE_MAKE_PROGRAM=${nixpkgs.gnumake}/bin/make -DCMAKE_AR=${nixpkgs.darwin.cctools}/bin/ar -DCMAKE_RANLIB=${nixpkgs.darwin.cctools}/bin/ranlib -DGMP_INCLUDE_DIR=${nixpkgs.gmp.dev}/include/ -DGMP_LIBRARIES=${nixpkgs.gmp}/lib/libgmp.10.dylib";
ar = "${nixpkgs.darwin.cctools}/bin/ar";
};
};
home.file.".ssh/config".source = ./ssh.config;
}

View File

@@ -0,0 +1,56 @@
{
config,
pkgs,
...
}: {
imports = [
../hardware/earthworm.nix
];
hardware.asahi.peripheralFirmwareDirectory = ../firmware;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false;
boot.extraModprobeConfig = ''
options hid_apple iso_layout=0
'';
networking = {
hostName = "earthworm";
networkmanager.enable = true;
};
time.timeZone = "Europe/London";
programs.sway.enable = true;
programs.zsh.enable = true;
# TODO: work out secrets management for password, then set mutableUsers to false
users.mutableUsers = true;
users.users.patrick = {
isNormalUser = true;
extraGroups = ["wheel" "networkManager"];
};
environment.systemPackages = [
pkgs.vim
pkgs.wget
];
environment.loginShellInit = ''
[[ "$(tty)" == /dev/tty1 ]] && sway
'';
services.openssh.enable = true;
system.stateVersion = "23.11";
nix.settings.experimental-features = ["nix-command" "flakes" "ca-derivations"];
nix.gc.automatic = true;
nix.extraOptions = ''
auto-optimise-store = true
max-jobs = auto
keep-outputs = true
keep-derivations = true
'';
}

View File

@@ -0,0 +1,29 @@
{
nixpkgs,
username,
dotnet,
...
}: {
home.packages = [nixpkgs.firefox-wayland];
nixpkgs.config.firefox.speechSynthesisSupport = true;
wayland.windowManager.sway = {
enable = true;
config = {
focus = {followMouse = false;};
modifier = "Mod4";
terminal = "alacritty";
window = {border = 5;};
};
extraConfig = ''
output Unknown-1 scale 2
'';
};
services.swayidle = {enable = true;};
services.cbatticon = {
lowLevelPercent = 20;
iconType = "standard";
enable = true;
};
}

220
home-manager/home.nix Normal file
View File

@@ -0,0 +1,220 @@
{
nixpkgs,
username,
dotnet,
...
}: {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = username;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.05";
programs.tmux = {
shell = "\${nixpkgs.zsh}/bin/zsh";
escapeTime = 50;
mouse = false;
prefix = "C-b";
};
programs.zsh = {
enable = true;
autocd = true;
enableAutosuggestions = true;
enableCompletion = true;
history = {
expireDuplicatesFirst = true;
};
oh-my-zsh = {
enable = true;
plugins = ["git" "macos" "dircycle" "timer"];
theme = "robbyrussell";
};
sessionVariables = {
EDITOR = "vim";
LC_ALL = "en_US.UTF-8";
LC_CTYPE = "en_US.UTF-8";
RUSTFLAGS = "-L ${nixpkgs.libiconv}/lib -L ${nixpkgs.libcxxabi}/lib -L ${nixpkgs.libcxx}/lib";
RUST_BACKTRACE = "full";
};
shellAliases = {
vim = "nvim";
view = "vim -R";
grep = "${nixpkgs.ripgrep}/bin/rg";
};
sessionVariables = {
RIPGREP_CONFIG_PATH = "/Users/${username}/.config/ripgrep/config";
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.git = {
package = nixpkgs.gitAndTools.gitFull;
enable = true;
userName = "Smaug123";
userEmail = "patrick+github@patrickstevens.co.uk";
aliases = {
co = "checkout";
st = "status";
};
extraConfig = {
rerere = {
enabled = true;
};
push = {
default = "current";
autoSetupRemote = true;
};
pull = {
rebase = false;
};
init = {
defaultBranch = "main";
};
advice = {
addIgnoredFile = false;
};
"filter \"lfs\"" = {
clean = "${nixpkgs.git-lfs} clean -- %f";
smudge = "${nixpkgs.git-lfs}/bin/git-lfs smudge --skip -- %f";
process = "${nixpkgs.git-lfs}/bin/git-lfs filter-process";
required = true;
};
pull = {
twohead = "ort";
};
merge = {
conflictStyle = "diff3";
};
diff = {
colorMoved = "default";
};
};
};
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = true;
enableUpdateCheck = true;
package = nixpkgs.vscode;
extensions = import ./vscode-extensions.nix {pkgs = nixpkgs;};
userSettings = {
workbench.colorTheme = "Default";
"files.Exclude" = {
"**/.git" = true;
"**/.DS_Store" = true;
"**/Thumbs.db" = true;
"**/*.olean" = true;
"**/result" = true;
};
"git.path" = "${nixpkgs.git}/bin/git";
"update.mode" = "none";
"docker.dockerPath" = "${nixpkgs.docker}/bin/docker";
"explorer.confirmDelete" = false;
};
};
programs.neovim.enable = true;
programs.neovim.plugins = with nixpkgs.vimPlugins; [
molokai
tagbar
{
plugin = rust-vim;
config = "let g:rustfmt_autosave = 1";
}
{
plugin = LanguageClient-neovim;
config = "let g:LanguageClient_serverCommands = { 'nix': ['rnix-lsp'] }";
}
{
plugin = syntastic;
config = '' let g:syntastic_rust_checkers = ['cargo']
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0'';
}
YouCompleteMe
tagbar
];
programs.neovim.viAlias = true;
programs.neovim.vimAlias = true;
programs.neovim.vimdiffAlias = true;
programs.neovim.withPython3 = true;
programs.neovim.extraConfig = builtins.readFile ./init.vim;
home.packages = [
nixpkgs.keepassxc
nixpkgs.rust-analyzer
nixpkgs.tmux
nixpkgs.wget
nixpkgs.yt-dlp
nixpkgs.cmake
nixpkgs.gnumake
nixpkgs.gcc
nixpkgs.lldb
nixpkgs.hledger
nixpkgs.hledger-web
dotnet
nixpkgs.docker
nixpkgs.jitsi-meet
nixpkgs.ripgrep
nixpkgs.elan
nixpkgs.coreutils-prefixed
nixpkgs.shellcheck
nixpkgs.html-tidy
nixpkgs.hugo
nixpkgs.agda
nixpkgs.pijul
nixpkgs.universal-ctags
nixpkgs.asciinema
nixpkgs.git-lfs
nixpkgs.imagemagick
nixpkgs.nixpkgs-fmt
nixpkgs.rnix-lsp
nixpkgs.grpc-tools
nixpkgs.element-desktop
nixpkgs.ihp-new
nixpkgs.direnv
nixpkgs.lnav
nixpkgs.age
nixpkgs.nodejs
nixpkgs.sqlitebrowser
nixpkgs.typst
nixpkgs.poetry
nixpkgs.woodpecker-agent
nixpkgs.alacritty
];
home.file.".ideavimrc".source = ./ideavimrc;
home.file.".config/yt-dlp/config".source = ./youtube-dl.conf;
home.file.".config/ripgrep/config".source = ./ripgrep.conf;
programs.emacs = {
enable = true;
package = nixpkgs.emacs;
extraPackages = epkgs: [];
extraConfig = ''
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
'';
};
home.file.".cargo/config.toml".source = ./cargo-config.toml;
}

3
home-manager/ideavimrc Normal file
View File

@@ -0,0 +1,3 @@
set ideajoin
set visualbell
set noerrorbells

View File

@@ -359,6 +359,7 @@ function! VisualSelection(direction, extra_filter) range
endfunction
nnoremap <leader>c :!cargo clippy
nnoremap <leader>j :%!python -m json.tool
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}

View File

@@ -1,6 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/Hierarchy/NuGetOptions/IncludePrerelease/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/AppBrowserSnapshotsStoreSettings/CurrentStore/@EntryValue">/Users/Patrick/Library/Preferences/Rider2019.3/resharper-host/Sessions</s:String>
<s:String x:Key="/Default/AppBrowserSnapshotsStoreSettings/CurrentStore/@EntryValue">/Users/patrick/Library/Preferences/Rider2019.3/resharper-host/Sessions</s:String>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/CacheImportCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/Roslyn/LegacySeveritiesMigrated/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/ExternalSources/Decompiler/DecompilerLegalNoticeAccepted/@EntryValue">True</s:Boolean>
@@ -34,7 +34,7 @@
<s:String x:Key="/Default/Profilers/Common/ConfigurationsStore/SelectedProfileConfigurationId/=NotSupported/@EntryIndexedValue">00000000-0000-0000-0000-000000000000</s:String>
<s:String x:Key="/Default/Profilers/Common/ConfigurationsStore/SelectedProfileTestsConfigurationId/=Any/@EntryIndexedValue">2704f639-7a6d-4dc0-8931-351a3f933333</s:String>
<s:Boolean x:Key="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/SnapshotsStore/CurrentStore/@EntryValue">/Users/Patrick/Library/Preferences/Rider2019.3/resharper-host/Sessions</s:String>
<s:String x:Key="/Default/SnapshotsStore/CurrentStore/@EntryValue">/Users/patrick/Library/Preferences/Rider2019.3/resharper-host/Sessions</s:String>
<s:Boolean x:Key="/Default/SymbolServers/RestoreDecompileSetting/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Leet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nums/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nums/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,49 @@
{
pkgs,
config,
lib,
...
}: let
src = ./GlobalSettingsStorage.DotSettings;
in let
link = ./link.sh;
in let
riderconfig = pkgs.stdenv.mkDerivation {
name = "rider-config";
version = "2023.1";
__contentAddressed = true;
src = src;
phases = ["unpackPhase"];
unpackPhase = ''
mkdir -p "$out"
cp ${src} "$out/GlobalSettingsStorage.DotSettings"
cp ${link} "$out/link.sh"
chmod u+x "$out/link.sh"
sed -i 's_NIX-DOTNET-SDK_${config.rider.dotnet}_' "$out/GlobalSettingsStorage.DotSettings"
sed -i "s!NIX-RIDER-CONFIG!$out!" "$out/link.sh"
'';
installPhase = ''
'';
};
in {
options = {
rider.enable = lib.mkOption {default = false;};
rider.username = lib.mkOption {
type = lib.types.str;
example = "Patrick";
};
rider.dotnet = lib.mkOption {default = pkgs.dotnet-sdk;};
};
config = lib.mkIf config.rider.enable {
home.activation.jetbrains-rider-settings = lib.hm.dag.entryAfter ["writeBoundary"] ''
dest="/Users/${config.rider.username}/Library/Application Support/JetBrains"
if [ -e "$dest" ]; then
find "$dest" -maxdepth 1 -type d -name 'Rider*' -exec sh -c '${riderconfig}/link.sh "$0"' {} \;
fi
'';
};
}

View File

@@ -0,0 +1,6 @@
# Don't let ripgrep vomit really long lines to my terminal, and show a preview.
--max-columns=150
--max-columns-preview
# Ignore contents of .git
--glob=!.git/*

View File

@@ -4,4 +4,4 @@ Host *
AddKeysToAgent yes
IgnoreUnknown UseKeychain
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_ed25519

View File

@@ -0,0 +1,111 @@
{pkgs}:
with pkgs.vscode-extensions;
[
bbenoist.nix
haskell.haskell
yzhang.markdown-all-in-one
james-yu.latex-workshop
vscodevim.vim
ms-dotnettools.csharp
ms-vscode-remote.remote-ssh
justusadam.language-haskell
rust-lang.rust-analyzer
github.vscode-pull-request-github
shardulm94.trailing-spaces
nvarner.typst-lsp
arrterian.nix-env-selector
]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "remote-containers";
publisher = "ms-vscode-remote";
version = "0.285.0";
sha256 = "sha256-UHp6Ewx0bUvPjgaO0A5k77SGj8ovPFLl/WvxyLcZ4y0=";
}
{
name = "vscode-hsx";
publisher = "s0kil";
version = "0.4.0";
sha256 = "sha256-/WRy+cQBqzb6QB5+AizlyIcjqNpZ86o2at885hOcroM=";
}
{
name = "vscode-docker";
publisher = "ms-azuretools";
version = "1.24.0";
sha256 = "sha256-zZ34KQrRPqVbfGdpYACuLMiMj4ZIWSnJIPac1yXD87k=";
}
{
name = "toml";
publisher = "be5invis";
version = "0.6.0";
sha256 = "yk7buEyQIw6aiUizAm+sgalWxUibIuP9crhyBaOjC2E=";
}
{
name = "Ionide-Paket";
publisher = "Ionide";
version = "2.0.0";
sha256 = "1455zx5p0d30b1agdi1zw22hj0d3zqqglw98ga8lj1l1d757gv6v";
}
{
name = "lean";
publisher = "jroesch";
version = "0.16.58";
sha256 = "sha256-e5+C6dAcpet4xOiifmTJ1vm2pNrcPhx/mjl70il5NG0=";
}
{
name = "lean4";
publisher = "leanprover";
version = "0.0.101";
sha256 = "sha256-tHxP6X6qp3qVkkCn5TjhHrYHHvGGWJ4kYE7la6bPT6w=";
}
{
name = "vscode-clang";
publisher = "mitaki28";
version = "0.2.4";
sha256 = "0sys2h4jvnannlk2q02lprc2ss9nkgh0f0kwa188i7viaprpnx23";
}
{
name = "dotnet-interactive-vscode";
publisher = "ms-dotnettools";
version = "1.0.4165021";
sha256 = "sha256-P5EHc5t4UyKEfxIGNTg+SyQPFlrbwaNIaprPY63iJ/k=";
}
{
name = "mono-debug";
publisher = "ms-vscode";
version = "0.16.3";
sha256 = "sha256-6IU8aP4FQVbEMZAgssGiyqM+PAbwipxou5Wk3Q2mjZg=";
}
{
name = "Theme-MarkdownKit";
publisher = "ms-vscode";
version = "0.1.4";
sha256 = "1im78k2gaj6cri2jcvy727qdy25667v0f7vv3p3hv13apzxgzl0l";
}
{
name = "debug";
publisher = "webfreak";
version = "0.26.1";
sha256 = "sha256-lLLa8SN+Sf9Tbi7HeWYWa2KhPQFJyQWrf9l3EUljwYo=";
}
]
++ [
(let
vsix = builtins.fetchurl {
name = "vadimcn-vscode-lldb.zip";
url = "https://github.com/vadimcn/codelldb/releases/download/v1.9.0/codelldb-aarch64-darwin.vsix";
sha256 = "sha256:1kxrxxlzasa9jl73lqh3n36fzpdgh2hbxpzp8fk6xyzcc5vm9zfb";
};
in
pkgs.vscode-utils.buildVscodeExtension
{
vsix = vsix;
src = vsix;
vscodeExtPublisher = "vadimcn";
vscodeExtName = "vscode-lldb";
vscodeExtUniqueId = "vadimcn-vscode-lldb";
publisher = "vadimcn";
version = "1.9.0";
name = "vadimcn-vscode-lldb-1.9.0";
})
]

189
home.nix
View File

@@ -1,189 +0,0 @@
{ config, pkgs, ... }:
let username = "Patrick"; in
let dotnet = pkgs.dotnet-sdk_6; in
{
imports = [ ./rider ./gmp ];
rider = { enable = true; username = username; dotnet = dotnet; };
gmp-symlink = { enable = true; };
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = username;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "21.11";
home.packages =
[
pkgs.rust-analyzer
pkgs.tmux
pkgs.wget
pkgs.youtube-dl
pkgs.cmake
pkgs.gnumake
pkgs.gcc
pkgs.gdb
pkgs.hledger
pkgs.hledger-web
dotnet
pkgs.docker
pkgs.jitsi-meet
#pkgs.handbrake
pkgs.ripgrep
pkgs.elan
pkgs.coreutils-prefixed
pkgs.shellcheck
pkgs.html-tidy
pkgs.hugo
#pkgs.agda
pkgs.pijul
pkgs.universal-ctags
pkgs.asciinema
pkgs.git-lfs
];
programs.vscode = {
enable = true;
package = pkgs.vscode;
extensions = import ./vscode-extensions.nix { inherit pkgs; };
userSettings = {
workbench.colorTheme = "Default High Contrast";
"files.Exclude" = {
"**/.git" = true;
"**/.DS_Store" = true;
"**/Thumbs.db" = true;
"**/*.olean" = true;
};
"git.path" = "${pkgs.git}/bin/git";
"update.mode" = "none";
"docker.dockerPath" = "${pkgs.docker}/bin/docker";
"lean.leanpkgPath" = "/Users/${username}/.elan/toolchains/stable/bin/leanpkg";
"lean.executablePath" = "/Users/${username}/.elan/toolchains/stable/bin/lean";
"lean.memoryLimit" = 8092;
};
};
programs.tmux = {
shell = "\${pkgs.zsh}/bin/zsh";
};
programs.zsh = {
enable = true;
autocd = true;
enableAutosuggestions = true;
enableCompletion = true;
history = {
expireDuplicatesFirst = true;
};
oh-my-zsh = {
enable = true;
plugins = [ "git" "macos" "dircycle" "timer" ];
theme = "robbyrussell";
};
sessionVariables = {
EDITOR = "vim";
LC_ALL = "en_US.UTF-8";
LC_CTYPE = "en_US.UTF-8";
RUSTFLAGS = "-L ${pkgs.libiconv}/lib";
RUST_BACKTRACE = "full";
};
shellAliases = {
vim = "nvim";
view = "vim -R";
nix-upgrade = "sudo -i sh -c 'nix-channel --update && nix-env -iA nixpkgs.nix && launchctl remove org.nixos.nix-daemon && launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'";
cmake = "cmake -DCMAKE_MAKE_PROGRAM=${pkgs.gnumake}/bin/make -DCMAKE_AR=${pkgs.darwin.cctools}/bin/ar -DCMAKE_RANLIB=${pkgs.darwin.cctools}/bin/ranlib -DGMP_INCLUDE_DIR=${pkgs.gmp.dev}/include/ -DGMP_LIBRARIES=${pkgs.gmp}/lib/libgmp.10.dylib";
ar = "${pkgs.darwin.cctools}/bin/ar";
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.git = {
package = pkgs.gitAndTools.gitFull;
enable = true;
userName = "Smaug123";
userEmail = "patrick+github@patrickstevens.co.uk";
aliases = {
co = "checkout";
st = "status";
};
extraConfig = {
rerere = {
enabled = true;
};
push = {
default = "current";
};
pull = {
rebase = false;
};
init = {
defaultBranch = "main";
};
advice = {
addIgnoredFile = false;
};
"filter \"lfs\"" = {
clean = "${pkgs.git-lfs} clean -- %f";
smudge = "${pkgs.git-lfs}/bin/git-lfs smudge --skip -- %f";
process = "${pkgs.git-lfs}/bin/git-lfs filter-process";
required = true;
};
};
};
programs.neovim.enable = true;
programs.neovim.plugins = with pkgs.vimPlugins; [
molokai
tagbar
{ plugin = rust-vim;
config = "let g:rustfmt_autosave = 1"; }
{ plugin = syntastic;
config = ''let g:syntastic_rust_checkers = ['cargo']
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0''; }
YouCompleteMe
tagbar
];
programs.neovim.viAlias = true;
programs.neovim.vimAlias = true;
programs.neovim.vimdiffAlias = true;
programs.neovim.withPython3 = true;
programs.neovim.extraConfig = builtins.readFile ./init.vim;
home.file.".ssh/config".source = ./ssh.config;
home.file.".ideavimrc".source = ./ideavimrc;
home.file.".config/youtube-dl/config".source = ./youtube-dl.conf;
programs.emacs = {
enable = true;
package = pkgs.emacsGcc;
extraPackages = (epkgs: []);
extraConfig = ''
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
'';
};
}

View File

@@ -1 +0,0 @@
set ideajoin

10
overlays.nix Normal file
View File

@@ -0,0 +1,10 @@
[
(self: super: {
# https://github.com/NixOS/nixpkgs/issues/153304
alacritty = super.alacritty.overrideAttrs (
o: rec {
doCheck = false;
}
);
})
]

View File

@@ -1,16 +1,14 @@
{ pkgs }:
let my-python-packages = python-packages: with python-packages; [
pip
mathlibtools
];
{pkgs}: let
my-python-packages = python-packages:
with python-packages; [
pip
mathlibtools
];
in let
packageOverrides = self: super: {
# Test failures on darwin ("windows-1252"); just skip pytest
# (required for elan)
beautifulsoup4 = super.beautifulsoup4.overridePythonAttrs (old: {pytestCheckPhase = "true";});
};
in
let packageOverrides = self: super: {
# Test failures on darwin ("windows-1252"); just skip pytest
# (required for elan)
beautifulsoup4 = super.beautifulsoup4.overridePythonAttrs(old: { pytestCheckPhase="true"; });
};
in
(pkgs.python3.override { inherit packageOverrides; }).withPackages my-python-packages
(pkgs.python3.override {inherit packageOverrides;}).withPackages my-python-packages

View File

@@ -1,44 +0,0 @@
{ pkgs, config, lib, ... }:
let src = ./GlobalSettingsStorage.DotSettings; in
let link = ./link.sh; in
let riderconfig =
pkgs.stdenv.mkDerivation {
name = "rider-config";
version = "2021.2";
src = src;
phases = [ "unpackPhase" ];
unpackPhase = ''
mkdir -p "$out"
cp ${src} "$out/GlobalSettingsStorage.DotSettings"
cp ${link} "$out/link.sh"
chmod u+x "$out/link.sh"
sed -i 's_NIX-DOTNET-SDK_${config.rider.dotnet}_' "$out/GlobalSettingsStorage.DotSettings"
sed -i "s!NIX-RIDER-CONFIG!$out!" "$out/link.sh"
'';
installPhase = ''
'';
};
in
{
options = {
rider.enable = lib.mkOption { default = false; };
rider.username = lib.mkOption { type = lib.types.str; example = "Patrick"; };
rider.dotnet = lib.mkOption { default = pkgs.dotnet-sdk; };
};
config = lib.mkIf config.rider.enable {
home.activation.jetbrains-rider-settings = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
dest="/Users/${config.rider.username}/Library/Application Support/JetBrains"
if [ -e "$dest" ]; then
find "$dest" -type d -maxdepth 1 -name 'Rider*' -exec sh -c '${riderconfig}/link.sh "$0"' {} \;
fi
'';
};
}

2
server-home.nix Normal file
View File

@@ -0,0 +1,2 @@
{nixpkgs, ...}: {
}

View File

@@ -1,110 +0,0 @@
{ pkgs }:
with pkgs.vscode-extensions; [
bbenoist.nix
haskell.haskell
yzhang.markdown-all-in-one
james-yu.latex-workshop
vscodevim.vim
# Doesn't work with vscodium, and unfree
# ms-vscode-remote.remote-ssh
# Not supported on Darwin, apparently
# ms-dotnettools.csharp
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "vscode-docker";
publisher = "ms-azuretools";
version = "1.14.0";
sha256 = "0wc0k3hf9yfjcx7cw9vm528v5f4bk968bgc98h8fwmlx14vhapzp";
}
{
name = "code-gnu-global";
publisher = "austin";
version = "0.2.2";
sha256 = "1fz89m6ja25aif6wszg9h2fh5vajk6bj3lp1mh0l2b04nw2mzhd5";
}
{
name = "rust-analyzer";
publisher = "matklad";
version = "0.2.792";
sha256 = "1m4g6nf5yhfjrjja0x8pfp79v04lxp5lfm6z91y0iilmqbb9kx1q";
}
{
name = "vscode-lldb";
publisher = "vadimcn";
version = "1.6.8";
sha256 = "1c81hs2lbcxshw3fnpajc9hzkpykc76a6hgs7wl5xji57782bckl";
}
{
name = "toml";
publisher = "be5invis";
version = "0.5.1";
sha256 = "1r1y6krqw5rrdhia9xbs3bx9gibd1ky4bm709231m9zvbqqwwq2j";
}
{
name = "Ionide-Paket";
publisher = "Ionide";
version = "2.0.0";
sha256 = "1455zx5p0d30b1agdi1zw22hj0d3zqqglw98ga8lj1l1d757gv6v";
}
{
name = "lean";
publisher = "jroesch";
version = "0.16.39";
sha256 = "0v1w0rmx2z7q6lfrl430fl6aq6n70y14s2fqsp734igdkdhdnvmk";
}
{
name = "language-haskell";
publisher = "justusadam";
version = "3.4.0";
sha256 = "0ab7m5jzxakjxaiwmg0jcck53vnn183589bbxh3iiylkpicrv67y";
}
{
name = "vscode-clang";
publisher = "mitaki28";
version = "0.2.4";
sha256 = "0sys2h4jvnannlk2q02lprc2ss9nkgh0f0kwa188i7viaprpnx23";
}
{
name = "dotnet-interactive-vscode";
publisher = "ms-dotnettools";
version = "1.0.2309031";
sha256 = "0vqlspq3696yyfsv17rpcbsaqs7nm7yvggv700sl1bia817cak10";
}
{
name = "python";
publisher = "ms-python";
version = "2021.5.926500501";
sha256 = "0hpb1z10ykg1sz0840qnas5ddbys9inqnjf749lvakj9spk1syk3";
}
{
name = "remote-containers";
publisher = "ms-vscode-remote";
version = "0.183.0";
sha256 = "12v7037rn46svv6ff2g824hdkk7l95g4gbzrp5zdddwxs0a62jlg";
}
{
name = "mono-debug";
publisher = "ms-vscode";
version = "0.16.2";
sha256 = "10hixqkw5r3cg52xkbky395lv72sb9d9wrngdvmrwx62hkbk5465";
}
{
name = "Theme-MarkdownKit";
publisher = "ms-vscode";
version = "0.1.4";
sha256 = "1im78k2gaj6cri2jcvy727qdy25667v0f7vv3p3hv13apzxgzl0l";
}
{
name = "trailing-spaces";
publisher = "shardulm94";
version = "0.3.1";
sha256 = "0h30zmg5rq7cv7kjdr5yzqkkc1bs20d72yz9rjqag32gwf46s8b8";
}
{
name = "debug";
publisher = "webfreak";
version = "0.25.1";
sha256 = "1l01sv6kwh8dlv3kygkkd0z9m37hahflzd5bx1wwij5p61jg7np9";
}
]