-
Notifications
You must be signed in to change notification settings - Fork 0
Clean up the Nix flake, recommended practices, provide overlay #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c85d8b9
flake: update description
spikespaz 4e9e3ab
flake: add alejandra as formatter
spikespaz 3dbfeee
flake: format nix code
spikespaz f5aef0b
flake: make systems overrideable
spikespaz 35b4ac8
flake: replace forAllSystems with eachSystem
spikespaz fabe645
flake: inherit lib at top level
spikespaz 9fb310f
flake: move usages of with to smallest scopes
spikespaz 8841ba2
flake: introduce overlay
spikespaz 29aef1d
flake: package: remove needless unpackPase override
spikespaz 5b9e5fa
flake: devShell: replace buildInputs with packages
spikespaz 9c8d7f6
chore: move alejandra to pre-commit-hook
daylinmorgan 589b98c
chore: inherit from nixpkgs.lib not nixpkgs
daylinmorgan 4ae5988
chore: remove some lets add others
daylinmorgan 8a95f2c
chore: change mkShell back to buildInputs
daylinmorgan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,58 @@ | ||
| { | ||
| description = "brain"; | ||
| inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
| description = "A script to patch the MonoLisa font with Nerd Fonts glyphs."; | ||
|
|
||
| outputs = inputs @ { | ||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
| systems.url = "github:nix-systems/default"; | ||
| }; | ||
|
|
||
| outputs = { | ||
| self, | ||
| nixpkgs, | ||
| systems, | ||
| }: let | ||
| inherit (nixpkgs.lib) genAttrs; | ||
| forAllSystems = f: | ||
| genAttrs | ||
| ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"] | ||
| (system: f nixpkgs.legacyPackages.${system}); | ||
| inherit (nixpkgs) lib; | ||
| eachSystem = fn: | ||
| lib.genAttrs (import systems) (system: let | ||
| pkgs = import nixpkgs { | ||
| localSystem.system = system; | ||
| overlays = [self.overlays.default]; | ||
| }; | ||
| in | ||
| fn system pkgs); | ||
| in { | ||
| packages = forAllSystems ( | ||
| pkgs: | ||
| with pkgs; { | ||
| default = stdenv.mkDerivation { | ||
| name = "monolisa-nerdfont-patch"; | ||
| src = ./.; | ||
| nativeBuildInputs = [ makeWrapper ]; | ||
| buildInputs = [ | ||
| fontforge | ||
| python3 | ||
| ]; | ||
| unpackPhase = ":"; | ||
| buildPhase = ":"; | ||
| installPhase = '' | ||
| mkdir -p $out/bin | ||
| install -m755 -D ${./patch-monolisa} $out/bin/monolisa-nerdfont-patch | ||
| install -m755 -D ${./font-patcher} $out/bin/font-patcher | ||
| cp -r ${./bin} $out/bin/bin | ||
| cp -r ${./src} $out/bin/src | ||
| ''; | ||
| postFixup = '' | ||
| wrapProgram $out/bin/monolisa-nerdfont-patch \ | ||
| --set PATH ${lib.makeBinPath [ | ||
| fontforge | ||
| ]} | ||
| overlays = { | ||
| default = final: prev: { | ||
| monolisa-nerdfont-patch = final.stdenv.mkDerivation { | ||
| name = "monolisa-nerdfont-patch"; | ||
| src = ./.; | ||
| nativeBuildInputs = with final; [makeWrapper]; | ||
| buildInputs = with final; [fontforge python3]; | ||
| buildPhase = ":"; | ||
| installPhase = '' | ||
| mkdir -p $out/bin | ||
| install -m755 -D ${./patch-monolisa} $out/bin/monolisa-nerdfont-patch | ||
| install -m755 -D ${./font-patcher} $out/bin/font-patcher | ||
| cp -r ${./bin} $out/bin/bin | ||
| cp -r ${./src} $out/bin/src | ||
| ''; | ||
| postFixup = '' | ||
| wrapProgram $out/bin/monolisa-nerdfont-patch \ | ||
| --set PATH ${lib.makeBinPath (with final; [fontforge])} | ||
| ''; | ||
| }; | ||
| }; | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| devShells = forAllSystems ( | ||
| pkgs: | ||
| with pkgs; { | ||
| default = mkShell { | ||
| buildInputs = [ | ||
| fontforge | ||
| python3 | ||
| pre-commit | ||
| ]; | ||
| }; | ||
| } | ||
| ); | ||
| packages = eachSystem (system: pkgs: { | ||
| default = self.packages.${system}.monolisa-nerdfont-patch; | ||
| monolisa-nerdfont-patch = pkgs.monolisa-nerdfont-patch; | ||
| }); | ||
|
|
||
| devShells = eachSystem (_: pkgs: { | ||
| default = pkgs.mkShell { | ||
| packages = with pkgs; [fontforge python3 pre-commit]; | ||
| }; | ||
| }); | ||
| }; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand not wanting to take the formatter's flake as an input, however consider re-introducing the
formatteroutput because it is special. You can use the package from Nixpkgs instead. The output allowsnix fmtto work. This is useful: I manually runnix fmtto keep myself organized while I am working on dirty code, and additionally, configure my editor to format the code using thenix fmtcommand when the file is saved. This allows me to write long lines, and then semi-automatically format to keep my head clear and the code readable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am well aware of how
nix fmtworks.