flake: migrate formatter to treefmt-nix #885
No files matched your search
Generated
+22
-1
@@ -520,7 +520,8 @@
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"ogygia": "ogygia",
|
||||
"qnaplcd-menu": "qnaplcd-menu",
|
||||
"status-jakehillion-me": "status-jakehillion-me"
|
||||
"status-jakehillion-me": "status-jakehillion-me",
|
||||
"treefmt-nix": "treefmt-nix_3"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
@@ -712,6 +713,26 @@
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770228511,
|
||||
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
darwin.url = "github:lnl7/nix-darwin";
|
||||
darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
@@ -60,6 +63,7 @@
|
||||
, ogygia
|
||||
, qnaplcd-menu
|
||||
, status-jakehillion-me
|
||||
, treefmt-nix
|
||||
, ...
|
||||
}@inputs:
|
||||
let
|
||||
@@ -80,6 +84,12 @@
|
||||
})
|
||||
];
|
||||
mkSystem = import ./lib/mkSystem.nix { inherit inputs; };
|
||||
treefmtEval = pkgs: treefmt-nix.lib.evalModule pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixpkgs-fmt.enable = true;
|
||||
programs.gofumpt.enable = true;
|
||||
programs.black.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit mkSystem;
|
||||
@@ -128,8 +138,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
} // flake-utils.lib.eachSystem [ "x86_64-linux" ] (
|
||||
system:
|
||||
} // nixpkgs.lib.recursiveUpdate
|
||||
(flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
@@ -138,32 +148,38 @@
|
||||
};
|
||||
in
|
||||
{
|
||||
# NixOS module tests
|
||||
checks = import ./tests {
|
||||
inherit pkgs system inputs;
|
||||
lib = nixpkgs.lib;
|
||||
formatter = (treefmtEval pkgs).config.build.wrapper;
|
||||
|
||||
checks = {
|
||||
formatting = (treefmtEval pkgs).config.build.check self;
|
||||
};
|
||||
|
||||
# App to auto-generate all snapshots: `nix run .#generate-snapshots`
|
||||
apps.generate-snapshots = {
|
||||
type = "app";
|
||||
program = "${import ./tests/generate-snapshots.nix {
|
||||
packages.caddy-with-dns = pkgs.caddy-with-dns;
|
||||
}))
|
||||
(flake-utils.lib.eachSystem [ "x86_64-linux" ] (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = getSystemOverlays system { };
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
in
|
||||
{
|
||||
# NixOS module tests
|
||||
checks = import ./tests {
|
||||
inherit pkgs system inputs;
|
||||
lib = nixpkgs.lib;
|
||||
};
|
||||
|
||||
# App to auto-generate all snapshots: `nix run .#generate-snapshots`
|
||||
apps.generate-snapshots = {
|
||||
type = "app";
|
||||
program = "${import ./tests/generate-snapshots.nix {
|
||||
inherit pkgs system inputs;
|
||||
lib = nixpkgs.lib;
|
||||
}}/bin/generate-snapshots";
|
||||
};
|
||||
}
|
||||
) // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = getSystemOverlays system { };
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
in
|
||||
{
|
||||
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
|
||||
|
||||
packages.caddy-with-dns = pkgs.caddy-with-dns;
|
||||
});
|
||||
};
|
||||
}
|
||||
));
|
||||
}
|
||||
@@ -8,20 +8,32 @@ from nltk.corpus import wordnet as wn
|
||||
try:
|
||||
wn.ensure_loaded()
|
||||
except LookupError:
|
||||
nltk.download('wordnet')
|
||||
nltk.download("wordnet")
|
||||
|
||||
|
||||
def get_adjectives_and_nouns():
|
||||
adjectives = [word for word in wn.all_lemma_names(pos='a') if len(word) > 1 and '_' not in word and '-' not in word]
|
||||
nouns = [word for word in wn.all_lemma_names(pos='n') if len(word) > 1 and '_' not in word and '-' not in word]
|
||||
adjectives = [
|
||||
word
|
||||
for word in wn.all_lemma_names(pos="a")
|
||||
if len(word) > 1 and "_" not in word and "-" not in word
|
||||
]
|
||||
nouns = [
|
||||
word
|
||||
for word in wn.all_lemma_names(pos="n")
|
||||
if len(word) > 1 and "_" not in word and "-" not in word
|
||||
]
|
||||
return adjectives, nouns
|
||||
|
||||
|
||||
adjectives, nouns = get_adjectives_and_nouns()
|
||||
|
||||
|
||||
def generate_random_word_list(N):
|
||||
selected_adjectives = random.sample(adjectives, N)
|
||||
noun = random.choice(nouns)
|
||||
return selected_adjectives + [noun]
|
||||
|
||||
|
||||
while True:
|
||||
random_word_list = generate_random_word_list(2)
|
||||
input(' '.join(random_word_list))
|
||||
input(" ".join(random_word_list))
|
||||
Reference in new issue
Block a user